1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // <vector> 11 12 // iterator insert(const_iterator p, initializer_list<value_type> il); 13 14 #include <vector> 15 #include <cassert> 16 17 #include "min_allocator.h" 18 19 int main() 20 { 21 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 22 { 23 std::vector<int> d(10, 1); 24 std::vector<int>::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6}); 25 assert(d.size() == 14); 26 assert(i == d.begin() + 2); 27 assert(d[0] == 1); 28 assert(d[1] == 1); 29 assert(d[2] == 3); 30 assert(d[3] == 4); 31 assert(d[4] == 5); 32 assert(d[5] == 6); 33 assert(d[6] == 1); 34 assert(d[7] == 1); 35 assert(d[8] == 1); 36 assert(d[9] == 1); 37 assert(d[10] == 1); 38 assert(d[11] == 1); 39 assert(d[12] == 1); 40 assert(d[13] == 1); 41 } 42 #if __cplusplus >= 201103L 43 { 44 std::vector<int, min_allocator<int>> d(10, 1); 45 std::vector<int, min_allocator<int>>::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6}); 46 assert(d.size() == 14); 47 assert(i == d.begin() + 2); 48 assert(d[0] == 1); 49 assert(d[1] == 1); 50 assert(d[2] == 3); 51 assert(d[3] == 4); 52 assert(d[4] == 5); 53 assert(d[5] == 6); 54 assert(d[6] == 1); 55 assert(d[7] == 1); 56 assert(d[8] == 1); 57 assert(d[9] == 1); 58 assert(d[10] == 1); 59 assert(d[11] == 1); 60 assert(d[12] == 1); 61 assert(d[13] == 1); 62 } 63 #endif 64 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 65 } 66