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 // _Container* __get_container(); // 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>
test(C c)23 TEST_CONSTEXPR_CXX20 bool test(C c) {
24   const std::back_insert_iterator<C> i(c);
25   assert(i.__get_container() == std::addressof(c));
26   return true;
27 }
28 
main(int,char **)29 int main(int, char**) {
30   test(std::vector<int>());
31   test(nasty_vector<int>());
32 #if TEST_STD_VER >= 20
33   test(ConstexprFixedCapacityDeque<int, 10>());
34   static_assert(test(ConstexprFixedCapacityDeque<int, 10>()));
35 #endif
36   return 0;
37 }
38