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// <iterator>
12
13// back_insert_iterator
14
15// requires CopyConstructible<Cont::value_type>
16// back_insert_iterator<Cont>&
17// operator=(Cont::value_type&& value);
18
19#include <iterator>
20
21#include <vector>
22#include <memory>
23#include <cassert>
24
25#include "test_macros.h"
26#include "test_constexpr_container.h"
27
28template <class C>
29TEST_CONSTEXPR_CXX14 bool
30test(C c)
31{
32 std::back_insert_iterator<C> i(c);
33 i = typename C::value_type();
34 assert(c.back() == typename C::value_type());
35 return true;
36}
37
38int main(int, char**)
39{
40 test(std::vector<std::unique_ptr<int> >());
41#if TEST_STD_VER >= 20
42 test(ConstexprFixedCapacityDeque<int, 10>());
43 static_assert(test(ConstexprFixedCapacityDeque<int, 10>()));
44#endif
45 return 0;
46}
47

source code of libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op=/rv_value.pass.cpp