Home | History | Annotate | Download | only in containers
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 #ifndef TEST_HASH_H
     11 #define TEST_HASH_H
     12 
     13 #include <cstddef>
     14 #include <type_traits>
     15 
     16 template <class C>
     17 class test_hash
     18     : private C
     19 {
     20     int data_;
     21 public:
     22     explicit test_hash(int data = 0) : data_(data) {}
     23 
     24     std::size_t
     25     operator()(typename std::add_lvalue_reference<const typename C::argument_type>::type x) const
     26         {return C::operator()(x);}
     27 
     28     bool operator==(const test_hash& c) const
     29         {return data_ == c.data_;}
     30 };
     31 
     32 #endif  // TEST_HASH_H
     33