Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | #ifndef TEST_COMPARE_H |
| 2 | #define TEST_COMPARE_H |
| 3 | |
| 4 | #include <cstddef> |
| 5 | #include <type_traits> |
| 6 | #include <cstdlib> |
| 7 | #include <new> |
| 8 | #include <climits> |
| 9 | |
| 10 | template <class C> |
| 11 | class test_compare |
| 12 | : private C |
| 13 | { |
| 14 | int data_; |
| 15 | public: |
| 16 | explicit test_compare(int data = 0) : data_(data) {} |
| 17 | |
| 18 | typename C::result_type |
| 19 | operator()(typename std::add_lvalue_reference<const typename C::first_argument_type>::type x, |
| 20 | typename std::add_lvalue_reference<const typename C::second_argument_type>::type y) const |
| 21 | {return C::operator()(x, y);} |
| 22 | |
| 23 | bool operator==(const test_compare& c) const |
| 24 | {return data_ == c.data_;} |
| 25 | }; |
| 26 | |
Howard Hinnant | 8f2f7e7 | 2010-08-22 00:15:28 +0000 | [diff] [blame] | 27 | #endif // TEST_COMPARE_H |