Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library/cpp/mime/types/mime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ MimeTypes TMimeTypes::MimeByStr(const char* str) const {
}

MimeTypes TMimeTypes::MimeByStr(const TStringBuf& str) const {
TRecordHash::const_iterator it = ContentTypes.find(str);
TRecordHash::const_iterator it = ContentTypes.find(str.data());
if (it == ContentTypes.end())
return MIME_UNKNOWN;
return Records[it->second].Mime;
Expand Down
2 changes: 1 addition & 1 deletion util/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,11 @@ _ydb_sdk_add_library(yutil)

target_compile_options(yutil PUBLIC
-DTSTRING_IS_STD_STRING
-DNO_CUSTOM_CHAR_PTR_STD_COMPARATOR
)

target_compile_options(yutil PRIVATE
-Wnarrowing
-DNO_CUSTOM_CHAR_PTR_STD_COMPARATOR
)

target_link_libraries(yutil PUBLIC
Expand Down
2 changes: 1 addition & 1 deletion util/charset/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ _ydb_sdk_add_library(util-charset)

target_compile_options(util-charset PUBLIC
-DTSTRING_IS_STD_STRING
-DNO_CUSTOM_CHAR_PTR_STD_COMPARATOR
)

target_compile_options(util-charset PRIVATE
-Wnarrowing
-DNO_CUSTOM_CHAR_PTR_STD_COMPARATOR
)

target_joined_source(util-charset
Expand Down
14 changes: 14 additions & 0 deletions util/str_stl.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,13 @@ struct TEqualTo<TUtf32String>: public TEqualTo<TUtf32StringBuf> {
using is_transparent = void;
};

template <>
struct TEqualTo<const char*> {
inline bool operator()(const char* a, const char* b) const {
return strcmp(a, b) == 0;
}
};

template <class TFirst, class TSecond>
struct TEqualTo<std::pair<TFirst, TSecond>> {
template <class TOther>
Expand Down Expand Up @@ -264,6 +271,13 @@ struct TLess<TUtf32String>: public TLess<TUtf32StringBuf> {
using is_transparent = void;
};

template <>
struct TLess<const char*> {
inline bool operator()(const char* a, const char* b) const {
return strcmp(a, b) < 0;
}
};

template <class T>
struct TGreater: public std::greater<T> {
};
Expand Down
Loading