[Github] Bump Windows Actions Runner to v2.321.0 (#123508)
[llvm-project.git] / libcxx / test / std / containers / sequences / vector / addressof.compile.pass.cpp
blob120b7b289af93e6d1fd684cf61fc0ff80a93fdcf
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 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03 && !stdlib=libc++
11 // <vector>
13 // Validate various member functions of std::vector with an ADL-hijacking operator&
15 #include <vector>
16 #include <utility>
18 #include "operator_hijacker.h"
19 #include "test_iterators.h"
21 using Vector = std::vector<operator_hijacker>;
23 void test(
24 Vector v, Vector::const_iterator it, cpp17_input_iterator<operator_hijacker*> other_it, operator_hijacker val) {
25 // emplace / insert
26 v.emplace(it);
27 v.insert(it, it, it);
28 v.insert(it, other_it, other_it);
29 v.insert(it, operator_hijacker());
30 v.insert(it, 1, val);
31 v.insert(it, val);
33 // erase
34 v.erase(it);
35 v.erase(it, it);
37 // assignment
38 v = static_cast<Vector&>(v);
39 v = std::move(v);
41 // construction
42 { Vector v2(std::move(v)); }
43 { Vector v2(std::move(v), std::allocator<operator_hijacker>()); }
45 // swap
46 v.swap(v);