issue#11: cds: changed __CDS_ guard prefix to CDSLIB_ for all .h files
[libcds.git] / tests / unit / pqueue / pqueue_item.h
1 //$$CDS-header$$
2
3 #ifndef CDSUNIT_PQUEUE_ITEM_H
4 #define CDSUNIT_PQUEUE_ITEM_H
5
6 namespace pqueue {
7     struct SimpleValue {
8         size_t      key;
9
10         typedef size_t  key_type;
11
12         struct key_extractor {
13             void operator()( key_type& k, SimpleValue const& s ) const
14             {
15                 k = s.key;
16             }
17         };
18
19         SimpleValue(): key(0) {}
20         SimpleValue( size_t n ): key(n) {}
21     };
22 }
23
24 namespace std {
25     template <>
26     struct less<pqueue::SimpleValue>
27     {
28         bool operator()( pqueue::SimpleValue const& k1, pqueue::SimpleValue const& k2 ) const
29         {
30             return k1.key < k2.key;
31         }
32
33         bool operator()( pqueue::SimpleValue const& k1, size_t k2 ) const
34         {
35             return k1.key < k2;
36         }
37
38         bool operator()( size_t k1, pqueue::SimpleValue const& k2 ) const
39         {
40             return k1 < k2.key;
41         }
42
43         bool operator()( size_t k1, size_t k2 ) const
44         {
45             return k1 < k2;
46         }
47     };
48
49     template <>
50     struct greater<pqueue::SimpleValue>
51     {
52         bool operator()( pqueue::SimpleValue const& k1, pqueue::SimpleValue const& k2 ) const
53         {
54             return k1.key > k2.key;
55         }
56
57         bool operator()( pqueue::SimpleValue const& k1, size_t k2 ) const
58         {
59             return k1.key > k2;
60         }
61
62         bool operator()( size_t k1, pqueue::SimpleValue const& k2 ) const
63         {
64             return k1 > k2.key;
65         }
66
67         bool operator()( size_t k1, size_t k2 ) const
68         {
69             return k1 > k2;
70         }
71     };
72
73 } // namespace std
74
75 #endif // #ifndef CDSUNIT_PQUEUE_ITEM_H