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 // UNSUPPORTED: c++98, c++03, c++11 11 // <vector> 12 // vector<bool> 13 14 // template <class... Args> iterator emplace(const_iterator pos, Args&&... args); 15 16 #include <vector> 17 #include <cassert> 18 #include "min_allocator.h" 19 main()20int main() 21 { 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, true); 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, true); 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 } 68