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 // template <BackInsertionContainer Cont> 12 // back_insert_iterator<Cont> 13 // back_inserter(Cont& x); 14 15 #include <iterator> 16 #include <vector> 17 #include <cassert> 18 #include "nasty_containers.h" 19 20 #include "test_macros.h" 21 22 template <class C> 23 void test(C c)24test(C c) 25 { 26 std::back_insert_iterator<C> i = std::back_inserter(c); 27 i = 0; 28 assert(c.size() == 1); 29 assert(c.back() == 0); 30 } 31 main(int,char **)32int main(int, char**) 33 { 34 test(std::vector<int>()); 35 test(nasty_vector<int>()); 36 37 return 0; 38 } 39