diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2017-04-12 22:51:27 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2017-04-12 22:51:27 +0000 |
commit | 5c80f4f6a265df7b6c7f9fe6281abfaf4f5a0c6e (patch) | |
tree | 573964e10311591360de9ad0d91ff171eb69ba14 /libcxx/include/optional | |
parent | a13ffe119a2995c290c6075c7a4c89ee031a80c5 (diff) | |
download | bcm5719-llvm-5c80f4f6a265df7b6c7f9fe6281abfaf4f5a0c6e.tar.gz bcm5719-llvm-5c80f4f6a265df7b6c7f9fe6281abfaf4f5a0c6e.zip |
Implement part of LWG#2857 - any/optional. Still to do - variant. Reviewed as https://reviews.llvm.org/D31956
llvm-svn: 300123
Diffstat (limited to 'libcxx/include/optional')
-rw-r--r-- | libcxx/include/optional | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libcxx/include/optional b/libcxx/include/optional index 10ad31e82f6..118d7178288 100644 --- a/libcxx/include/optional +++ b/libcxx/include/optional @@ -87,7 +87,7 @@ namespace std { constexpr optional() noexcept; constexpr optional(nullopt_t) noexcept; optional(const optional &); - optional(optional &&) noexcept(see below ); + optional(optional &&) noexcept(see below); template <class... Args> constexpr explicit optional(in_place_t, Args &&...); template <class U, class... Args> constexpr explicit optional(in_place_t, initializer_list<U>, Args &&...); @@ -108,9 +108,9 @@ namespace std { template <class U = T> optional &operator=(U &&); template <class U> optional &operator=(const optional<U> &); template <class U> optional &operator=(optional<U> &&); - template <class... Args> void emplace(Args &&...); + template <class... Args> T& emplace(Args &&...); template <class U, class... Args> - void emplace(initializer_list<U>, Args &&...); + T& emplace(initializer_list<U>, Args &&...); // 20.6.3.4, swap void swap(optional &) noexcept(see below ); @@ -729,11 +729,12 @@ public: > > _LIBCPP_INLINE_VISIBILITY - void + _Tp & emplace(_Args&&... __args) { reset(); this->__construct(_VSTD::forward<_Args>(__args)...); + return this->__get(); } template <class _Up, class... _Args, @@ -743,11 +744,12 @@ public: > > _LIBCPP_INLINE_VISIBILITY - void + _Tp & emplace(initializer_list<_Up> __il, _Args&&... __args) { reset(); this->__construct(__il, _VSTD::forward<_Args>(__args)...); + return this->__get(); } _LIBCPP_INLINE_VISIBILITY |