Skip to content

Commit 1d0a3cb

Browse files
authored
Removed custom std comparator (#558)
* Removed custom std comparator * fix
1 parent 25529d4 commit 1d0a3cb

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

library/cpp/mime/types/mime.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ MimeTypes TMimeTypes::MimeByStr(const char* str) const {
158158
}
159159

160160
MimeTypes TMimeTypes::MimeByStr(const TStringBuf& str) const {
161-
TRecordHash::const_iterator it = ContentTypes.find(str);
161+
TRecordHash::const_iterator it = ContentTypes.find(str.data());
162162
if (it == ContentTypes.end())
163163
return MIME_UNKNOWN;
164164
return Records[it->second].Mime;

util/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,11 @@ _ydb_sdk_add_library(yutil)
387387

388388
target_compile_options(yutil PUBLIC
389389
-DTSTRING_IS_STD_STRING
390+
-DNO_CUSTOM_CHAR_PTR_STD_COMPARATOR
390391
)
391392

392393
target_compile_options(yutil PRIVATE
393394
-Wnarrowing
394-
-DNO_CUSTOM_CHAR_PTR_STD_COMPARATOR
395395
)
396396

397397
target_link_libraries(yutil PUBLIC

util/charset/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ _ydb_sdk_add_library(util-charset)
66

77
target_compile_options(util-charset PUBLIC
88
-DTSTRING_IS_STD_STRING
9+
-DNO_CUSTOM_CHAR_PTR_STD_COMPARATOR
910
)
1011

1112
target_compile_options(util-charset PRIVATE
1213
-Wnarrowing
13-
-DNO_CUSTOM_CHAR_PTR_STD_COMPARATOR
1414
)
1515

1616
target_joined_source(util-charset

util/str_stl.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,13 @@ struct TEqualTo<TUtf32String>: public TEqualTo<TUtf32StringBuf> {
211211
using is_transparent = void;
212212
};
213213

214+
template <>
215+
struct TEqualTo<const char*> {
216+
inline bool operator()(const char* a, const char* b) const {
217+
return strcmp(a, b) == 0;
218+
}
219+
};
220+
214221
template <class TFirst, class TSecond>
215222
struct TEqualTo<std::pair<TFirst, TSecond>> {
216223
template <class TOther>
@@ -264,6 +271,13 @@ struct TLess<TUtf32String>: public TLess<TUtf32StringBuf> {
264271
using is_transparent = void;
265272
};
266273

274+
template <>
275+
struct TLess<const char*> {
276+
inline bool operator()(const char* a, const char* b) const {
277+
return strcmp(a, b) < 0;
278+
}
279+
};
280+
267281
template <class T>
268282
struct TGreater: public std::greater<T> {
269283
};

0 commit comments

Comments
 (0)