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 // template <class... Args> iterator emplace(const_iterator pos, Args&&... args); 14 15 #include <vector> 16 #include <cassert> 17 #include "min_allocator.h" 18 main()19int main() 20 { 21 #if _LIBCPP_STD_VER > 11 22 { 23 typedef std::vector<bool> C; 24 C c; 25 26 C::iterator i = c.emplace(c.cbegin()); 27 assert(i == c.begin()); 28 assert(c.size() == 1); 29 assert(c.front() == false); 30 31 i = c.emplace(c.cend(), true); 32 assert(i == c.end()-1); 33 assert(c.size() == 2); 34 assert(c.front() == false); 35 assert(c.back() == true); 36 37 i = c.emplace(c.cbegin()+1, 1 == 1); 38 assert(i == c.begin()+1); 39 assert(c.size() == 3); 40 assert(c.front() == false); 41 assert(c[1] == true); 42 assert(c.back() == true); 43 } 44 { 45 typedef std::vector<bool, min_allocator<bool>> C; 46 C c; 47 48 C::iterator i = c.emplace(c.cbegin()); 49 assert(i == c.begin()); 50 assert(c.size() == 1); 51 assert(c.front() == false); 52 53 i = c.emplace(c.cend(), true); 54 assert(i == c.end()-1); 55 assert(c.size() == 2); 56 assert(c.front() == false); 57 assert(c.back() == true); 58 59 i = c.emplace(c.cbegin()+1, 1 == 1); 60 assert(i == c.begin()+1); 61 assert(c.size() == 3); 62 assert(c.size() == 3); 63 assert(c.front() == false); 64 assert(c[1] == true); 65 assert(c.back() == true); 66 } 67 #endif 68 } 69