diff options
| author | Eric Fiselier <eric@efcs.ca> | 2016-07-21 03:20:17 +0000 |
|---|---|---|
| committer | Eric Fiselier <eric@efcs.ca> | 2016-07-21 03:20:17 +0000 |
| commit | 0e411641a338b0effbdcbcd6f0772a0663729afd (patch) | |
| tree | 0c0f13d524a1dede6b8bf225a6110a9bfc19efd9 /libcxx/include/vector | |
| parent | fa7c6f0d84bc1148eb1d17a18ad0b80d5521ba16 (diff) | |
| download | bcm5719-llvm-0e411641a338b0effbdcbcd6f0772a0663729afd.tar.gz bcm5719-llvm-0e411641a338b0effbdcbcd6f0772a0663729afd.zip | |
Implement P0084r2. Changing emplace return types.
llvm-svn: 276230
Diffstat (limited to 'libcxx/include/vector')
| -rw-r--r-- | libcxx/include/vector | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/libcxx/include/vector b/libcxx/include/vector index 021bbfb6643..16d48ae58d1 100644 --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -99,7 +99,7 @@ public: void push_back(const value_type& x); void push_back(value_type&& x); template <class... Args> - void emplace_back(Args&&... args); + reference emplace_back(Args&&... args); void pop_back(); template <class... Args> iterator emplace(const_iterator position, Args&&... args); @@ -218,7 +218,7 @@ public: const_reference back() const; void push_back(const value_type& x); - template <class... Args> void emplace_back(Args&&... args); // C++14 + template <class... Args> reference emplace_back(Args&&... args); // C++14 void pop_back(); template <class... Args> iterator emplace(const_iterator position, Args&&... args); // C++14 @@ -687,7 +687,7 @@ public: #ifndef _LIBCPP_HAS_NO_VARIADICS template <class... _Args> _LIBCPP_INLINE_VISIBILITY - void emplace_back(_Args&&... __args); + reference emplace_back(_Args&&... __args); #endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY @@ -1632,7 +1632,7 @@ vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args) template <class _Tp, class _Allocator> template <class... _Args> inline -void +typename vector<_Tp, _Allocator>::reference vector<_Tp, _Allocator>::emplace_back(_Args&&... __args) { if (this->__end_ < this->__end_cap()) @@ -1646,6 +1646,7 @@ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args) } else __emplace_back_slow_path(_VSTD::forward<_Args>(__args)...); + return this->back(); } #endif // _LIBCPP_HAS_NO_VARIADICS @@ -2314,8 +2315,10 @@ public: void push_back(const value_type& __x); #if _LIBCPP_STD_VER > 11 template <class... _Args> - _LIBCPP_INLINE_VISIBILITY void emplace_back(_Args&&... __args) - { push_back ( value_type ( _VSTD::forward<_Args>(__args)... )); } + _LIBCPP_INLINE_VISIBILITY reference emplace_back(_Args&&... __args) { + push_back ( value_type ( _VSTD::forward<_Args>(__args)... )); + return this->back(); + } #endif _LIBCPP_INLINE_VISIBILITY void pop_back() {--__size_;} |

