mirror of
https://github.com/boostorg/optional.git
synced 2025-07-29 12:07:21 +02:00
Catching up with N4078
This commit is contained in:
@ -72,12 +72,14 @@
|
||||
T* operator ->() ; ``[link reference_optional_operator_arrow __GO_TO__]``
|
||||
|
||||
T const& operator *() const& ; ``[link reference_optional_operator_asterisk __GO_TO__]``
|
||||
T& operator *() &; ``[link reference_optional_operator_asterisk __GO_TO__]``
|
||||
T operator *() &&; ``[link reference_optional_operator_asterisk_move __GO_TO__]``
|
||||
T& operator *() & ; ``[link reference_optional_operator_asterisk __GO_TO__]``
|
||||
T operator *() && ; ``[link reference_optional_operator_asterisk_move __GO_TO__]``
|
||||
T operator *() const&& ; ``[link reference_optional_operator_asterisk_move __GO_TO__]``
|
||||
|
||||
T const& value() const& ; ``[link reference_optional_value __GO_TO__]``
|
||||
T& value() & ; ``[link reference_optional_value __GO_TO__]``
|
||||
T value() && ; ``[link reference_optional_value_move __GO_TO__]``
|
||||
T value() const&& ; ``[link reference_optional_value_move __GO_TO__]``
|
||||
|
||||
template<class U> T value_or( U && v ) const& ; ``[link reference_optional_value_or __GO_TO__]``
|
||||
template<class U> T value_or( U && v ) && ; ``[link reference_optional_value_or_move __GO_TO__]``
|
||||
@ -863,22 +865,24 @@ __SPACE__
|
||||
[#reference_optional_operator_asterisk_move]
|
||||
|
||||
[: `T optional<T` ['(not a ref)]`>::operator*() &&;`]
|
||||
[: `T optional<T` ['(not a ref)]`>::operator*() const&&;`]
|
||||
|
||||
* [*Requires:] `T` is __MOVE_CONSTRUCTIBLE__ and `*this` is initialized.
|
||||
* [*Returns:] A move-constructed copy the contained value.
|
||||
* [*Throws:] Whatever the `T`'s constructor selected for the move throws.
|
||||
* [*Notes:] The requirement is asserted via `BOOST_ASSERT()`. On compilers that do not support ref-qualifiers on member functions this overload is not present.
|
||||
* [*Requires:] `*this` contains a value.
|
||||
* [*Effects:] Equivalent to `return std::move(*val);`.
|
||||
* [*Remarks:] If `T` is not __MOVE_CONSTRUCTIBLE__, the program is ill-formed.
|
||||
* [*Notes:] The requirement is asserted via `BOOST_ASSERT()`. On GCC compiler the second overload is not present, as this compiler incorrectly implements binding of references to const prvalues. On compilers that do not support ref-qualifiers on member functions both these overloads are not present.
|
||||
|
||||
__SPACE__
|
||||
|
||||
[: `T const& optional<T&>::operator*() const& ;`]
|
||||
[: `T & optional<T&>::operator*() & ;`]
|
||||
[: `T & optional<T&>::operator*() && ;`]
|
||||
[: `T & optional<T&>::operator*() const& ;`]
|
||||
[: `T & optional<T&>::operator*() & ;`]
|
||||
[: `T & optional<T&>::operator*() && ;`]
|
||||
[: `T & optional<T&>::operator*() const&& ;`]
|
||||
|
||||
* [*Requires: ] `*this` is initialized
|
||||
* [*Returns:] [_The] reference contained.
|
||||
* [*Throws:] Nothing.
|
||||
* [*Notes:] The requirement is asserted via `BOOST_ASSERT()`. On compilers that do not support ref-qualifiers on member functions these three overloads are replaced with the classical two: a `const` and non-`const` member functions.
|
||||
* [*Notes:] The requirement is asserted via `BOOST_ASSERT()`. On GCC compiler the fourth overload is not present, as this compiler incorrectly implements binding of references to const prvalues. On compilers that do not support ref-qualifiers on member functions these four overloads are replaced with the classical two: a `const` and non-`const` member functions.
|
||||
* [*Example:]
|
||||
``
|
||||
T v ;
|
||||
@ -897,8 +901,7 @@ __SPACE__
|
||||
[: `T const& optional<T>::value() const& ;`]
|
||||
[: `T& optional<T>::value() & ;`]
|
||||
|
||||
* [*Returns:] A reference to the contained value, if `*this` is initialized.
|
||||
* [*Throws:] An instance of `bad_optional_access`, if `*this` is not initialized.
|
||||
* [*Effects:] Equivalent to `return bool(*this) ? *val : throw bad_optional_access();`.
|
||||
* [*Notes:] On compilers that do not support ref-qualifiers on member functions these two overloads are replaced with the classical two: a `const` and non-`const` member functions.
|
||||
* [*Example:]
|
||||
``
|
||||
@ -919,12 +922,12 @@ __SPACE__
|
||||
|
||||
[#reference_optional_value_move]
|
||||
|
||||
[: `T optional<T>::value() && ;`]
|
||||
[: `T optional<T>::value() && ;`]
|
||||
[: `T optional<T>::value() const&& ;`]
|
||||
|
||||
* [*Requires:] `T` is __MOVE_CONSTRUCTIBLE__.
|
||||
* [*Returns:] A move-constructed copy of the contained value, if `*this` is initialized.
|
||||
* [*Throws:] An instance of `bad_optional_access`, if `*this` is not initialized.
|
||||
* [*Notes:] On compilers that do not support ref-qualifiers on member functions this overload is not present.
|
||||
* [*Effects:] Equivalent to `return bool(*this) ? std::move(*val) : throw bad_optional_access();`.
|
||||
* [*Remarks:] If `T` is not __MOVE_CONSTRUCTIBLE__, the program is ill-formed.
|
||||
* [*Notes:] On GCC compiler the second overload is not present, as this compiler incorrectly implements binding of references to const prvalues. On compilers that do not support ref-qualifiers on member functions both these overloads are not present.
|
||||
|
||||
__SPACE__
|
||||
|
||||
@ -933,8 +936,8 @@ __SPACE__
|
||||
|
||||
[: `template<class U> T optional<T>::value_or(U && v) const& ;`]
|
||||
|
||||
* [*Requires:] `T` is __COPY_CONSTRUCTIBLE__ and `U &&` is convertible to `T`.
|
||||
* [*Effects:] `if (*this) return **this; else return std::forward<U>(v);`.
|
||||
* [*Effects:] Equivalent to `if (*this) return **this; else return std::forward<U>(v);`.
|
||||
* [*Remarks:] If `T` is not __COPY_CONSTRUCTIBLE__ or `U &&` is not convertible to `T`, the program is ill-formed.
|
||||
* [*Notes:] On compilers that do not support ref-qualifiers on member functions this overload is replaced with the `const`-qualified member function. On compilers without rvalue reference support the type of `v` becomes `U const&`.
|
||||
|
||||
__SPACE__
|
||||
@ -943,8 +946,8 @@ __SPACE__
|
||||
|
||||
[: `template<class U> T optional<T>::value_or(U && v) && ;`]
|
||||
|
||||
* [*Requires:] `T` is __MOVE_CONSTRUCTIBLE__ and `U &&` is convertible to `T`.
|
||||
* [*Effects:] `if (*this) return std::move(**this); else return std::forward<U>(v);`.
|
||||
* [*Effects:] Equivalent to `if (*this) return std::move(**this); else return std::forward<U>(v);`.
|
||||
* [*Remarks:] If `T` is not __MOVE_CONSTRUCTIBLE__ or `U &&` is not convertible to `T`, the program is ill-formed.
|
||||
* [*Notes:] On compilers that do not support ref-qualifiers on member functions this overload is not present.
|
||||
|
||||
__SPACE__
|
||||
|
Reference in New Issue
Block a user