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 #include "asan_testing.h" 19 20 int main() 21 { 22 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 23 { 24 std::vector<int> v; 25 v.reserve(3); 26 assert(is_contiguous_container_asan_correct(v)); 27 v = { 1, 2, 3 }; 28 v.emplace(v.begin(), v.back()); 29 assert(v[0] == 3); 30 assert(is_contiguous_container_asan_correct(v)); 31 } 32 { 33 std::vector<int> v; 34 v.reserve(4); 35 assert(is_contiguous_container_asan_correct(v)); 36 v = { 1, 2, 3 }; 37 v.emplace(v.begin(), v.back()); 38 assert(v[0] == 3); 39 assert(is_contiguous_container_asan_correct(v)); 40 } 41 #if __cplusplus >= 201103L 42 { 43 std::vector<int, min_allocator<int>> v; 44 v.reserve(3); 45 assert(is_contiguous_container_asan_correct(v)); 46 v = { 1, 2, 3 }; 47 v.emplace(v.begin(), v.back()); 48 assert(v[0] == 3); 49 assert(is_contiguous_container_asan_correct(v)); 50 } 51 { 52 std::vector<int, min_allocator<int>> v; 53 v.reserve(4); 54 assert(is_contiguous_container_asan_correct(v)); 55 v = { 1, 2, 3 }; 56 v.emplace(v.begin(), v.back()); 57 assert(v[0] == 3); 58 assert(is_contiguous_container_asan_correct(v)); 59 } 60 #endif 61 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 62 } 63