brintos

brintos / llvm-project-archived public Read only

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