diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt index 994e5163a2..9220b75b74 100644 --- a/util/CMakeLists.txt +++ b/util/CMakeLists.txt @@ -96,8 +96,7 @@ if (YDB_SDK_TESTS) generic/stack_ut.cpp generic/store_policy_ut.cpp generic/strbuf_ut.cpp - # TODO: uncomment this test after we get the fix - # generic/string_transparent_hash_ut.cpp + generic/string_transparent_hash_ut.cpp generic/string_ut.cpp generic/typelist_ut.cpp generic/typetraits_ut.cpp diff --git a/util/generic/string_transparent_hash_ut.cpp b/util/generic/string_transparent_hash_ut.cpp index b87fa2843e..a03fc7e6d7 100644 --- a/util/generic/string_transparent_hash_ut.cpp +++ b/util/generic/string_transparent_hash_ut.cpp @@ -3,15 +3,27 @@ #include "strbuf.h" #include -#include #include +#ifdef __cpp_lib_generic_unordered_lookup + #include + +template +using THashSetType = std::unordered_set; +#else + // Using Abseil hash set because `std::unordered_set` is transparent only from libstdc++11. + // Meanwhile clang-linux-x86_64-release-stl-system autocheck sets OS_SDK=ubuntu-20, + // that support libstdc++10 by default. + #include + +template +using THashSetType = absl::flat_hash_set; +#endif + Y_UNIT_TEST_SUITE(StringHashFunctorTests) { Y_UNIT_TEST(TestTransparencyWithUnorderedSet) { - // Using Abseil hash set because `std::unordered_set` is transparent only from C++20 (while - // we stuck with C++17 right now). - absl::flat_hash_set, TEqualTo> s = {"foo"}; + THashSetType, TEqualTo> s = {"foo"}; // If either `THash` or `TEqualTo` is not transparent compilation will fail. UNIT_ASSERT_UNEQUAL(s.find(TStringBuf("foo")), s.end()); UNIT_ASSERT_EQUAL(s.find(TStringBuf("bar")), s.end());