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 // template <class... Args> iterator emplace(const_iterator pos, Args&&... args); 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<int> v; 24 v.reserve(3); 25 v = { 1, 2, 3 }; 26 v.emplace(v.begin(), v.back()); 27 assert(v[0] == 3); 28 } 29 { 30 std::vector<int> v; 31 v.reserve(4); 32 v = { 1, 2, 3 }; 33 v.emplace(v.begin(), v.back()); 34 assert(v[0] == 3); 35 } 36 #if __cplusplus >= 201103L 37 { 38 std::vector<int, min_allocator<int>> v; 39 v.reserve(3); 40 v = { 1, 2, 3 }; 41 v.emplace(v.begin(), v.back()); 42 assert(v[0] == 3); 43 } 44 { 45 std::vector<int, min_allocator<int>> v; 46 v.reserve(4); 47 v = { 1, 2, 3 }; 48 v.emplace(v.begin(), v.back()); 49 assert(v[0] == 3); 50 } 51 #endif 52 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 53 } 54