198760c18f85bafd98dde7a309e1b0e677abd47d8Marshall Clow//===----------------------------------------------------------------------===//
298760c18f85bafd98dde7a309e1b0e677abd47d8Marshall Clow//
398760c18f85bafd98dde7a309e1b0e677abd47d8Marshall Clow//                     The LLVM Compiler Infrastructure
498760c18f85bafd98dde7a309e1b0e677abd47d8Marshall Clow//
598760c18f85bafd98dde7a309e1b0e677abd47d8Marshall Clow// This file is dual licensed under the MIT and the University of Illinois Open
698760c18f85bafd98dde7a309e1b0e677abd47d8Marshall Clow// Source Licenses. See LICENSE.TXT for details.
798760c18f85bafd98dde7a309e1b0e677abd47d8Marshall Clow//
898760c18f85bafd98dde7a309e1b0e677abd47d8Marshall Clow//===----------------------------------------------------------------------===//
998760c18f85bafd98dde7a309e1b0e677abd47d8Marshall Clow
10bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant#ifndef TEST_HASH_H
11bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant#define TEST_HASH_H
12bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
13bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant#include <cstddef>
14bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant#include <type_traits>
15bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
16bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnanttemplate <class C>
17bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnantclass test_hash
18bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    : private C
19bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant{
20bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    int data_;
21bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnantpublic:
22bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    explicit test_hash(int data = 0) : data_(data) {}
23bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
24bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    std::size_t
25bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    operator()(typename std::add_lvalue_reference<const typename C::argument_type>::type x) const
26bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant        {return C::operator()(x);}
27bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
28bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    bool operator==(const test_hash& c) const
29bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant        {return data_ == c.data_;}
30bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant};
31bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
326046aced820aaab4f14f2026531dd11d10690691Howard Hinnant#endif  // TEST_HASH_H
33