File tree 1 file changed +15
-2
lines changed
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change 3
3
#include " strbuf.h"
4
4
5
5
#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
7
12
8
13
#include < util/str_stl.h>
9
14
10
15
Y_UNIT_TEST_SUITE (StringHashFunctorTests) {
11
16
Y_UNIT_TEST (TestTransparencyWithUnorderedSet) {
12
17
// Using Abseil hash set because `std::unordered_set` is transparent only from C++20 (while
13
18
// 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" };
15
28
// If either `THash` or `TEqualTo` is not transparent compilation will fail.
16
29
UNIT_ASSERT_UNEQUAL (s.find (TStringBuf (" foo" )), s.end ());
17
30
UNIT_ASSERT_EQUAL (s.find (TStringBuf (" bar" )), s.end ());
You can’t perform that action at this time.
0 commit comments