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 // vector<bool> 12 13 // iterator insert(const_iterator position, size_type n, const value_type& x); 14 15 #include <vector> 16 #include <cassert> 17 18 #include "min_allocator.h" 19 main()20int main() 21 { 22 { 23 std::vector<bool> v(100); 24 std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 5, 1); 25 assert(v.size() == 105); 26 assert(i == v.begin() + 10); 27 int j; 28 for (j = 0; j < 10; ++j) 29 assert(v[j] == 0); 30 for (; j < 15; ++j) 31 assert(v[j] == 1); 32 for (++j; j < 105; ++j) 33 assert(v[j] == 0); 34 } 35 #if __cplusplus >= 201103L 36 { 37 std::vector<bool, min_allocator<bool>> v(100); 38 std::vector<bool, min_allocator<bool>>::iterator i = v.insert(v.cbegin() + 10, 5, 1); 39 assert(v.size() == 105); 40 assert(i == v.begin() + 10); 41 int j; 42 for (j = 0; j < 10; ++j) 43 assert(v[j] == 0); 44 for (; j < 15; ++j) 45 assert(v[j] == 1); 46 for (++j; j < 105; ++j) 47 assert(v[j] == 0); 48 } 49 #endif 50 } 51