]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/hash.pass.cpp
Vendor import of libc++ trunk r290819:
[FreeBSD/FreeBSD.git] / test / std / experimental / utilities / propagate_const / propagate_const.nonmembers / hash.pass.cpp
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 // UNSUPPORTED: c++98, c++03, c++11
11
12 // <propagate_const>
13
14 // template <class T> struct hash<experimental::fundamentals_v2::propagate_const<T>>;
15
16 #include <experimental/propagate_const>
17 #include "propagate_const_helpers.h"
18 #include <cassert>
19
20 using std::experimental::propagate_const;
21
22 namespace std {
23 template <> struct hash<X>
24 {
25   typedef X first_argument_type;
26
27   size_t operator()(const first_argument_type&) const
28   {
29     return 99;
30   }
31
32 };
33 } // namespace std
34
35 int main() {
36
37   typedef propagate_const<X> P;
38
39   P p(1);
40
41   auto h = std::hash<P>();
42
43   assert(h(p)==99);
44 }