fixed optional<optional<T>&> case

This commit is contained in:
Andrzej Krzemienski
2016-05-17 00:54:09 +02:00
parent 0755ab7b4e
commit 08076e3964
7 changed files with 64 additions and 0 deletions

View File

@ -96,6 +96,7 @@ public:
template <class U>
explicit optional(const optional<U&>& rhs) BOOST_NOEXCEPT : ptr_(rhs.ptr_) {}
optional(const optional& rhs) BOOST_NOEXCEPT : ptr_(rhs.ptr_) {}
optional(T& rhs) BOOST_NOEXCEPT : ptr_(boost::addressof(rhs)) {}
optional& operator=(const optional& rhs) BOOST_NOEXCEPT { ptr_ = rhs.ptr_; return *this; }
@ -121,6 +122,8 @@ public:
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
optional(T&& rhs) BOOST_NOEXCEPT { detail::prevent_binding_rvalue<T&&>(); }
template <class R>
optional(R&& r, BOOST_DEDUCED_TYPENAME boost::enable_if<detail::is_no_optional<R> >::type* = 0) BOOST_NOEXCEPT
: ptr_(boost::addressof(r)) { detail::prevent_binding_rvalue<R>(); }