Debian Codegraph @

libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/hash.pass.cpp

raw
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 // UNSUPPORTED: c++03, c++11
10
11 // <propagate_const>
12
13 // template <class T> struct hash<experimental::fundamentals_v2::propagate_const<T>>;
14
15 #include <experimental/propagate_const>
16 #include "test_macros.h"
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 std::size_t operator()(const first_argument_type&) const
28 {
29 return 99;
30 }
31
32 };
33 } // namespace std
34
35 int main(int, char**) {
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
45 return 0;
46 }