Debian Codegraph @

libcxx/test/std/containers/unord/unord.map/unord.map.swap/swap.addressof.compile.pass.cpp

raw
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 // UNSUPPORTED: c++03
10
11 // <unordered_map>
12
13 // void swap(unordered_map& c)
14 // noexcept(allocator_traits<Allocator>::is_always_equal::value &&
15 // noexcept(swap(declval<Hash&>(), declval<Hash&>())) &&
16 // noexcept(swap(declval<Pred&>(), declval<Pred&>())));
17
18 // Validate whether the operation properly guards against ADL-hijacking operator&
19
20 #include <unordered_map>
21
22 #include "test_macros.h"
23 #include "operator_hijacker.h"
24
25 void test() {
26 std::unordered_map<operator_hijacker, operator_hijacker> m1;
27 std::unordered_map<operator_hijacker, operator_hijacker> m2;
28 std::swap(m1, m2);
29 }