Debian Codegraph @

libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.cons/test.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 // <iterator>
10
11 // insert_iterator
12
13 // insert_iterator(Cont& x, Cont::iterator i); // constexpr in C++20
14
15 #include <iterator>
16 #include <vector>
17
18 #include "test_macros.h"
19 #include "nasty_containers.h"
20 #include "test_constexpr_container.h"
21
22 template <class C>
23 TEST_CONSTEXPR_CXX20 bool
24 test(C c)
25 {
26 std::insert_iterator<C> i(c, c.begin());
27 return true;
28 }
29
30 int main(int, char**)
31 {
32 test(std::vector<int>());
33 test(nasty_vector<int>());
34 #if TEST_STD_VER >= 20
35 test(ConstexprFixedCapacityDeque<int, 10>());
36 static_assert(test(ConstexprFixedCapacityDeque<int, 10>()));
37 #endif
38 return 0;
39 }