| 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 |
// <unordered_set> |
| 10 |
|
| 11 |
// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, |
| 12 |
// class Alloc = allocator<Value>> |
| 13 |
// class unordered_set |
| 14 |
|
| 15 |
// hasher hash_function() const; |
| 16 |
|
| 17 |
#include <unordered_set> |
| 18 |
#include <cassert> |
| 19 |
|
| 20 |
int main(int, char**) { |
| 21 |
typedef std::unordered_set<int> set_type; |
| 22 |
set_type s; |
| 23 |
|
| 24 |
std::pair<set_type::iterator, bool> p = s.insert(1); |
| 25 |
|
| 26 |
const set_type& cs = s; |
| 27 |
assert(cs.hash_function()(*p.first) == cs.hash_function()(1)); |
| 28 |
assert(cs.hash_function()(1) == cs.hash_function()(*p.first)); |
| 29 |
|
| 30 |
return 0; |
| 31 |
} |