diff --git a/libcxx/include/vector b/libcxx/include/vector index 282713e70fbec47e4c21dec248d3b39e67690239..61f0aef748f9ca4c12bd81ce3031145ccbb68641 100644 --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -796,6 +796,11 @@ private: #else __push_back_slow_path(_Up& __x); #endif +#if !defined(_LIBCPP_HAS_NO_VARIADICS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) + template + void + __emplace_back_slow_path(_Args&&... __args); +#endif }; template @@ -1495,6 +1500,19 @@ vector<_Tp, _Allocator>::push_back(value_type&& __x) template template void +vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args) +{ + allocator_type& __a = this->__alloc(); + __split_buffer __v(__recommend(size() + 1), size(), __a); +// __v.emplace_back(_VSTD::forward<_Args>(__args)...); + __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(__v.__end_++), _VSTD::forward<_Args>(__args)...); + __swap_out_circular_buffer(__v); +} + +template +template +_LIBCPP_INLINE_VISIBILITY inline +void vector<_Tp, _Allocator>::emplace_back(_Args&&... __args) { if (this->__end_ < this->__end_cap()) @@ -1505,12 +1523,7 @@ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args) ++this->__end_; } else - { - allocator_type& __a = this->__alloc(); - __split_buffer __v(__recommend(size() + 1), size(), __a); - __v.emplace_back(_VSTD::forward<_Args>(__args)...); - __swap_out_circular_buffer(__v); - } + __emplace_back_slow_path(_VSTD::forward<_Args>(__args)...); } #endif // _LIBCPP_HAS_NO_VARIADICS