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, 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, 1); 25 assert(v.size() == 101); 26 assert(i == v.begin() + 10); 27 int j; 28 for (j = 0; j < 10; ++j) 29 assert(v[j] == 0); 30 assert(v[j] == 1); 31 for (++j; j < 101; ++j) 32 assert(v[j] == 0); 33 } 34 #if __cplusplus >= 201103L 35 { 36 std::vector<bool, min_allocator<bool>> v(100); 37 std::vector<bool, min_allocator<bool>>::iterator i = v.insert(v.cbegin() + 10, 1); 38 assert(v.size() == 101); 39 assert(i == v.begin() + 10); 40 int j; 41 for (j = 0; j < 10; ++j) 42 assert(v[j] == 0); 43 assert(v[j] == 1); 44 for (++j; j < 101; ++j) 45 assert(v[j] == 0); 46 } 47 #endif 48 } 49