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<bool> d(10, true); 24 std::vector<bool>::iterator i = d.insert(d.cbegin() + 2, {false, true, true, false}); 25 assert(d.size() == 14); 26 assert(i == d.begin() + 2); 27 assert(d[0] == true); 28 assert(d[1] == true); 29 assert(d[2] == false); 30 assert(d[3] == true); 31 assert(d[4] == true); 32 assert(d[5] == false); 33 assert(d[6] == true); 34 assert(d[7] == true); 35 assert(d[8] == true); 36 assert(d[9] == true); 37 assert(d[10] == true); 38 assert(d[11] == true); 39 assert(d[12] == true); 40 assert(d[13] == true); 41 } 42 #if __cplusplus >= 201103L 43 { 44 std::vector<bool, min_allocator<bool>> d(10, true); 45 std::vector<bool, min_allocator<bool>>::iterator i = d.insert(d.cbegin() + 2, {false, true, true, false}); 46 assert(d.size() == 14); 47 assert(i == d.begin() + 2); 48 assert(d[0] == true); 49 assert(d[1] == true); 50 assert(d[2] == false); 51 assert(d[3] == true); 52 assert(d[4] == true); 53 assert(d[5] == false); 54 assert(d[6] == true); 55 assert(d[7] == true); 56 assert(d[8] == true); 57 assert(d[9] == true); 58 assert(d[10] == true); 59 assert(d[11] == true); 60 assert(d[12] == true); 61 assert(d[13] == true); 62 } 63 #endif 64 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 65 } 66