diff --git a/doc/20_reference.qbk b/doc/20_reference.qbk index 9b14267..cba3bac 100644 --- a/doc/20_reference.qbk +++ b/doc/20_reference.qbk @@ -73,13 +73,11 @@ 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 *() const&& ; ``[link reference_optional_operator_asterisk_move __GO_TO__]`` + T&& operator *() && ; ``[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__]`` + T&& value() && ; ``[link reference_optional_value_move __GO_TO__]`` template T value_or( U && v ) const& ; ``[link reference_optional_value_or __GO_TO__]`` template T value_or( U && v ) && ; ``[link reference_optional_value_or_move __GO_TO__]`` @@ -864,25 +862,22 @@ __SPACE__ [#reference_optional_operator_asterisk_move] -[: `T optional::operator*() &&;`] -[: `T optional::operator*() const&&;`] +[: `T&& optional::operator*() &&;`] * [*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. +* [*Notes:] The requirement is asserted via `BOOST_ASSERT()`. On compilers that do not support ref-qualifiers on member functions this overload is not present. __SPACE__ [: `T & optional::operator*() const& ;`] [: `T & optional::operator*() & ;`] [: `T & optional::operator*() && ;`] -[: `T & optional::operator*() const&& ;`] * [*Requires: ] `*this` is initialized * [*Returns:] [_The] reference contained. * [*Throws:] Nothing. -* [*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. +* [*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. * [*Example:] `` T v ; @@ -922,12 +917,10 @@ __SPACE__ [#reference_optional_value_move] -[: `T optional::value() && ;`] -[: `T optional::value() const&& ;`] +[: `T&& optional::value() && ;`] * [*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. +* [*Notes:] On compilers that do not support ref-qualifiers on member functions this overload is not present. __SPACE__ diff --git a/doc/html/boost_optional/reference/detailed_semantics.html b/doc/html/boost_optional/reference/detailed_semantics.html index e41bb4e..dfbfc87 100644 --- a/doc/html/boost_optional/reference/detailed_semantics.html +++ b/doc/html/boost_optional/reference/detailed_semantics.html @@ -1334,12 +1334,8 @@ space

- T optional<T - (not a ref)>::operator*() &&; -

-

- T optional<T - (not a ref)>::operator*() const&&; + T&& + optional<T (not a ref)>::operator*() &&;

  • @@ -1348,18 +1344,11 @@
  • Effects: Equivalent to return std::move(*val);.
  • -
  • - Remarks: If T - is not MoveConstructible, - 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. + On compilers that do not support ref-qualifiers on member functions this + overload is not present.

@@ -1377,11 +1366,6 @@ T & optional<T&>::operator*() && ;

-

- T & - optional<T&>::operator*() const&& - ; -

  • Requires: *this is initialized @@ -1396,11 +1380,9 @@
  • 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. + 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.
  • Example: @@ -1454,11 +1436,8 @@ space

    - T optional<T>::value() && - ; -

    -

    - T optional<T>::value() const&& ; + T&& + optional<T>::value() && ;

    • @@ -1466,15 +1445,8 @@ bad_optional_access();.
    • - Remarks: If T - is not MoveConstructible, - 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. + Notes: On compilers that do not support + ref-qualifiers on member functions this overload is not present.

    diff --git a/doc/html/index.html b/doc/html/index.html index fc616b7..9b48711 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -133,7 +133,7 @@

- +

Last revised: June 27, 2014 at 22:17:04 GMT

Last revised: July 10, 2014 at 11:41:49 GMT


diff --git a/doc/html/optional/reference.html b/doc/html/optional/reference.html index 3ce1cb9..9c157df 100644 --- a/doc/html/optional/reference.html +++ b/doc/html/optional/reference.html @@ -97,13 +97,11 @@ T const& operator *() const& ; R T& operator *() & ; R - T operator *() && ; R - T operator *() const&& ; R + T&& operator *() && ; R T const& value() const& ; R T& value() & ; R - T value() && ; R - T value() const&& ; R + T&& value() && ; R template<class U> T value_or( U && v ) const& ; R template<class U> T value_or( U && v ) && ; R diff --git a/include/boost/optional/optional.hpp b/include/boost/optional/optional.hpp index 8d6971f..07c4bd3 100644 --- a/include/boost/optional/optional.hpp +++ b/include/boost/optional/optional.hpp @@ -1005,12 +1005,9 @@ class optional : public optional_detail::optional_base // 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()) ; } -#ifdef BOOST_CLANG - value_type operator *() const&& { return boost::move(this->get()) ; } -#endif + reference_const_type operator *() const& { return this->get() ; } + reference_type operator *() & { return this->get() ; } + reference_type_of_temporary_wrapper operator *() && { return boost::move(this->get()) ; } #else reference_const_type operator *() const { return this->get() ; } reference_type operator *() { return this->get() ; } @@ -1033,22 +1030,13 @@ class optional : public optional_detail::optional_base throw_exception(bad_optional_access()); } - value_type value() && + reference_type_of_temporary_wrapper value() && { if (this->is_initialized()) return boost::move(this->get()) ; else 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