issue#11: tests/test-hdr: changed .h file guard prefix to CDSTEST_xxx
[libcds.git] / tests / test-hdr / size_check.h
1 //$$CDS-header$$
2
3 #ifndef CDSTEST_SIZE_CHECK_H
4 #define CDSTEST_SIZE_CHECK_H
5
6 #include <cds/algo/atomic.h>
7
8 namespace misc {
9
10     template <typename ItemCounter>
11     struct size_checker {
12         template <typename Container>
13         bool operator()( Container const& c, size_t nSize ) const
14         {
15             return c.size() == nSize;
16         }
17     };
18
19     template<>
20     struct size_checker< cds::atomicity::empty_item_counter > {
21         template <typename Container>
22         bool operator()( Container const& /*c*/, size_t /*nSize*/ ) const
23         {
24             return true;
25         }
26     };
27
28     template <class Container>
29     static inline bool check_size( Container const& cont, size_t nSize )
30     {
31         return size_checker<typename Container::item_counter>()( cont, nSize );
32     }
33
34 } // namespace misc
35
36 #endif // #ifndef CDSTEST_SIZE_CHECK_H