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// back_insert_iterator
12
13// explicit back_insert_iterator(Cont& x); // 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
22template <class C>
23TEST_CONSTEXPR_CXX20 bool
24test(C c)
25{
26 std::back_insert_iterator<C> i(c);
27 return true;
28}
29
30int 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}
40

source code of libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.cons/container.pass.cpp