brintos

brintos / llvm-project-archived public Read only

0
0
Text · 994 B · fb0c607 Raw
44 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++03, c++1110 11// <propagate_const>12 13// template <class T> struct hash<experimental::fundamentals_v2::propagate_const<T>>;14 15#include <experimental/propagate_const>16#include <cassert>17#include <cstddef>18#include <functional>19 20#include "test_macros.h"21#include "propagate_const_helpers.h"22 23using std::experimental::propagate_const;24 25template <>26struct std::hash<X> {27  typedef X first_argument_type;28 29  std::size_t operator()(const first_argument_type&) const { return 99; }30};31 32int main(int, char**) {33 34  typedef propagate_const<X> P;35 36  P p(1);37 38  auto h = std::hash<P>();39 40  assert(h(p)==99);41 42  return 0;43}44