forked from boostorg/optional
Catching up with N4078
This commit is contained in:
@ -1005,13 +1005,16 @@ class optional : public optional_detail::optional_base<T>
|
||||
// the behaviour is UNDEFINED
|
||||
// No-throw
|
||||
#ifndef BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
reference_const_type operator *() const& { return this->get() ; }
|
||||
reference_type operator *() & { return this->get() ; }
|
||||
value_type operator *() && { return boost::move(this->get()) ; }
|
||||
reference_const_type operator *() const& { return this->get() ; }
|
||||
reference_type operator *() & { return this->get() ; }
|
||||
value_type operator *() && { return boost::move(this->get()) ; }
|
||||
#ifdef BOOST_CLANG
|
||||
value_type operator *() const&& { return boost::move(this->get()) ; }
|
||||
#endif
|
||||
#else
|
||||
reference_const_type operator *() const { return this->get() ; }
|
||||
reference_type operator *() { return this->get() ; }
|
||||
#endif
|
||||
#endif // !defined BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
|
||||
#ifndef BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
reference_const_type value() const&
|
||||
@ -1019,7 +1022,7 @@ class optional : public optional_detail::optional_base<T>
|
||||
if (this->is_initialized())
|
||||
return this->get() ;
|
||||
else
|
||||
throw_exception(bad_optional_access("Attempted to access the value of an uninitialized optional object."));
|
||||
throw_exception(bad_optional_access());
|
||||
}
|
||||
|
||||
reference_type value() &
|
||||
@ -1027,7 +1030,7 @@ class optional : public optional_detail::optional_base<T>
|
||||
if (this->is_initialized())
|
||||
return this->get() ;
|
||||
else
|
||||
throw_exception(bad_optional_access("Attempted to access the value of an uninitialized optional object."));
|
||||
throw_exception(bad_optional_access());
|
||||
}
|
||||
|
||||
value_type value() &&
|
||||
@ -1035,15 +1038,25 @@ class optional : public optional_detail::optional_base<T>
|
||||
if (this->is_initialized())
|
||||
return boost::move(this->get()) ;
|
||||
else
|
||||
throw_exception(bad_optional_access("Attempted to access the value of an uninitialized optional object."));
|
||||
throw_exception(bad_optional_access());
|
||||
}
|
||||
#ifdef BOOST_CLANG
|
||||
value_type value() const&&
|
||||
{
|
||||
if (this->is_initialized())
|
||||
return boost::move(this->get()) ;
|
||||
else
|
||||
throw_exception(bad_optional_access());
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
reference_const_type value() const
|
||||
{
|
||||
if (this->is_initialized())
|
||||
return this->get() ;
|
||||
else
|
||||
throw_exception(bad_optional_access("Attempted to access the value of an uninitialized optional object."));
|
||||
throw_exception(bad_optional_access());
|
||||
}
|
||||
|
||||
reference_type value()
|
||||
@ -1051,7 +1064,7 @@ class optional : public optional_detail::optional_base<T>
|
||||
if (this->is_initialized())
|
||||
return this->get() ;
|
||||
else
|
||||
throw_exception(bad_optional_access("Attempted to access the value of an uninitialized optional object."));
|
||||
throw_exception(bad_optional_access());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user