| 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 | |
| 14 | // class unordered_set |
| 15 | |
| 16 | #include <unordered_set> |
| 17 | |
| 18 | #include "test_macros.h" |
| 19 | #include "operator_hijacker.h" |
| 20 | |
| 21 | template <class ToIterator, class FromIterator> |
| 22 | void test() { |
| 23 | FromIterator from; |
| 24 | ToIterator copy(from); |
| 25 | copy = from; |
| 26 | |
| 27 | ToIterator move(std::move(from)); |
| 28 | from = FromIterator(); |
| 29 | move = std::move(from); |
| 30 | } |
| 31 | |
| 32 | void test() { |
| 33 | { |
| 34 | using I = std::unordered_set<operator_hijacker>::iterator; |
| 35 | using CI = std::unordered_set<operator_hijacker>::const_iterator; |
| 36 | test<I, I>(); |
| 37 | test<CI, I>(); |
| 38 | test<CI, CI>(); |
| 39 | } |
| 40 | { |
| 41 | using IL = std::unordered_set<operator_hijacker>::local_iterator; |
| 42 | using CIL = std::unordered_set<operator_hijacker>::const_local_iterator; |
| 43 | test<IL, IL>(); |
| 44 | test<CIL, IL>(); |
| 45 | test<CIL, CIL>(); |
| 46 | } |
| 47 | } |
| 48 | |