issue#11: tests/test-hdr: changed .h file guard prefix to CDSTEST_xxx
[libcds.git] / tests / test-hdr / set / intrusive_cuckoo_set_common.h
1 //$$CDS-header$$
2
3 #ifndef CDSTEST_HDR_INTRUSIVE_CUCKOO_SET_COMMON_H
4 #define CDSTEST_HDR_INTRUSIVE_CUCKOO_SET_COMMON_H
5
6 namespace set {
7     namespace {
8
9         typedef IntrusiveCuckooSetHdrTest::hash_int    hash1;
10         struct hash2: private hash1
11         {
12             typedef hash1 base_class;
13
14             size_t operator()( int i ) const
15             {
16                 size_t h = ~( base_class::operator()(i));
17                 return ~h + 0x9e3779b9 + (h << 6) + (h >> 2);
18             }
19             template <typename Item>
20             size_t operator()( const Item& i ) const
21             {
22                 size_t h = ~( base_class::operator()(i));
23                 return ~h + 0x9e3779b9 + (h << 6) + (h >> 2);
24             }
25             size_t operator()( IntrusiveCuckooSetHdrTest::find_key const& i) const
26             {
27                 size_t h = ~( base_class::operator()(i));
28                 return ~h + 0x9e3779b9 + (h << 6) + (h >> 2);
29             }
30         };
31
32         template <typename T>
33         struct equal_to
34         {
35             bool operator ()(const T& v1, const T& v2 ) const
36             {
37                 return v1.key() == v2.key();
38             }
39
40             template <typename Q>
41             bool operator ()(const T& v1, const Q& v2 ) const
42             {
43                 return v1.key() == v2;
44             }
45
46             template <typename Q>
47             bool operator ()(const Q& v1, const T& v2 ) const
48             {
49                 return v1 == v2.key();
50             }
51         };
52
53     }
54 } // namespace set
55
56 #endif // #ifndef CDSTEST_HDR_INTRUSIVE_CUCKOO_SET_COMMON_H