brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 6eb5fca Raw
67 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++0310 11// <unordered_set>12 13// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,14//           class Alloc = allocator<Value>>15// class unordered_multiset16 17// template <class... Args>18//     iterator emplace_hint(const_iterator p, Args&&... args);19 20#include <unordered_set>21#include <cassert>22 23#include "test_macros.h"24#include "../../Emplaceable.h"25#include "min_allocator.h"26 27int main(int, char**) {28  {29    typedef std::unordered_multiset<Emplaceable> C;30    typedef C::iterator R;31    C c;32    C::const_iterator e = c.end();33    R r                 = c.emplace_hint(e);34    assert(c.size() == 1);35    assert(*r == Emplaceable());36 37    r = c.emplace_hint(c.end(), Emplaceable(5, 6));38    assert(c.size() == 2);39    assert(*r == Emplaceable(5, 6));40 41    r = c.emplace_hint(r, 5, 6);42    assert(c.size() == 3);43    assert(*r == Emplaceable(5, 6));44  }45  {46    typedef std::47        unordered_multiset<Emplaceable, std::hash<Emplaceable>, std::equal_to<Emplaceable>, min_allocator<Emplaceable>>48            C;49    typedef C::iterator R;50    C c;51    C::const_iterator e = c.end();52    R r                 = c.emplace_hint(e);53    assert(c.size() == 1);54    assert(*r == Emplaceable());55 56    r = c.emplace_hint(c.end(), Emplaceable(5, 6));57    assert(c.size() == 2);58    assert(*r == Emplaceable(5, 6));59 60    r = c.emplace_hint(r, 5, 6);61    assert(c.size() == 3);62    assert(*r == Emplaceable(5, 6));63  }64 65  return 0;66}67