Skip to content

Commit eebe4b0

Browse files
committed
Fix string_transparent_hash_ut (#158)
1 parent b749b9a commit eebe4b0

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

util/generic/string_transparent_hash_ut.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,28 @@
33
#include "strbuf.h"
44

55
#include <library/cpp/testing/unittest/registar.h>
6-
#include <library/cpp/containers/absl_flat_hash/flat_hash_set.h>
6+
7+
#if __cplusplus < 202002L
8+
#include <library/cpp/containers/absl_flat_hash/flat_hash_set.h>
9+
#else
10+
#include <unordered_set>
11+
#endif
712

813
#include <util/str_stl.h>
914

1015
Y_UNIT_TEST_SUITE(StringHashFunctorTests) {
1116
Y_UNIT_TEST(TestTransparencyWithUnorderedSet) {
1217
// Using Abseil hash set because `std::unordered_set` is transparent only from C++20 (while
1318
// we stuck with C++17 right now).
14-
absl::flat_hash_set<TString, THash<TString>, TEqualTo<TString>> s = {"foo"};
19+
using TTransparentHashSet =
20+
#if __cplusplus < 202002L
21+
absl::flat_hash_set
22+
#else
23+
std::unordered_set
24+
#endif
25+
<TString, THash<TString>, TEqualTo<TString>>;
26+
27+
TTransparentHashSet s = {"foo"};
1528
// If either `THash` or `TEqualTo` is not transparent compilation will fail.
1629
UNIT_ASSERT_UNEQUAL(s.find(TStringBuf("foo")), s.end());
1730
UNIT_ASSERT_EQUAL(s.find(TStringBuf("bar")), s.end());

0 commit comments

Comments
 (0)