diff --git a/doc/00_optional.qbk b/doc/00_optional.qbk index 02e21f4..00b6096 100644 --- a/doc/00_optional.qbk +++ b/doc/00_optional.qbk @@ -2,7 +2,7 @@ [quickbook 1.4] [authors [Cacciola Carballal, Fernando Luis]] [copyright 2003-2007 Fernando Luis Cacciola Carballal] - [copyright 2014-2017 Andrzej Krzemieński] + [copyright 2014-2018 Andrzej Krzemieński] [category miscellaneous] [id optional] [dirname optional] diff --git a/doc/27_ref_optional_synopsis.qbk b/doc/27_ref_optional_synopsis.qbk index 1a6a849..8454218 100644 --- a/doc/27_ref_optional_synopsis.qbk +++ b/doc/27_ref_optional_synopsis.qbk @@ -179,6 +179,10 @@ They are empty, trivially copyable classes with disabled default constructor. template T value_or_eval( F f ) const& ; ``[link reference_optional_value_or_call __GO_TO__]`` template T value_or_eval( F f ) && ; ``[link reference_optional_value_or_call_move __GO_TO__]`` + template auto map( F f ) const& -> ``['see below]``; ``[link reference_optional_map __GO_TO__]`` + template auto map( F f ) & -> ``['see below]``; ``[link reference_optional_map __GO_TO__]`` + template auto map( F f ) && -> ``['see below]``; ``[link reference_optional_map_move __GO_TO__]`` + T const* get_ptr() const ; ``[link reference_optional_get_ptr __GO_TO__]`` T* get_ptr() ; ``[link reference_optional_get_ptr __GO_TO__]`` diff --git a/doc/28_ref_optional_semantics.qbk b/doc/28_ref_optional_semantics.qbk index 8c1397f..320da2d 100644 --- a/doc/28_ref_optional_semantics.qbk +++ b/doc/28_ref_optional_semantics.qbk @@ -685,6 +685,25 @@ __SPACE__ __SPACE__ +[#reference_optional_map] + +[: `template auto optional::map(F f) const& -> ``['see below]`` ;`] +[: `template auto optional::map(F f) & -> ``['see below]`` ;`] + +* [*Effects:] `if (*this) return f(**this); else return none;` +* [*Notes:] The return type of these overloads is `optional`. On compilers that do not support ref-qualifiers on member functions, these two (as well as the next one) overloads are replaced with good old const and non-const overloads. + +__SPACE__ + +[#reference_optional_map_move] + +[: `template auto optional::map(F f) && -> ``['see below]`` ;`] + +* [*Effects:] `if (*this) return f(std::move(**this)); else return none;` +* [*Notes:] The return type of this overload is `optional`. + +__SPACE__ + [#reference_optional_get_value_or_value] [: `T const& optional::get_value_or( T const& default) const ;`] diff --git a/doc/91_relnotes.qbk b/doc/91_relnotes.qbk index 93e9799..79bb200 100644 --- a/doc/91_relnotes.qbk +++ b/doc/91_relnotes.qbk @@ -14,6 +14,7 @@ [heading Boost Release 1.68] * Added member function `has_value()` for compatibility with `std::optional` ([@https://github.com/boostorg/optional/issues/52 issue #52]). +* Added member function `map()` for transforming `optional` into `optional` using a function of type `U(T)`. [heading Boost Release 1.67] diff --git a/doc/html/boost_optional/acknowledgements.html b/doc/html/boost_optional/acknowledgements.html index f91a9f2..c6f9f2f 100644 --- a/doc/html/boost_optional/acknowledgements.html +++ b/doc/html/boost_optional/acknowledgements.html @@ -116,8 +116,7 @@ -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+

+ space +

+

+ template<class F> auto optional<T>::map(F f) const& -> + ['see below] ; +

+

+ template<class F> auto optional<T>::map(F f) & -> ['see below] + ; +

+
    +
  • + Effects: if + (*this) return f(**this); else return + none; +
  • +
  • + Notes: The return type of these overloads + is optional<decltype(f(**this)>. + On compilers that do not support ref-qualifiers on member functions, + these two (as well as the next one) overloads are replaced with good + old const and non-const overloads. +
  • +
+

+ space +

+

+ template<class F> auto optional<T>::map(F f) && + -> ['see below] + ; +

+
    +
  • + Effects: if + (*this) return f(std::move(**this)); else return + none; +
  • +
  • + Notes: The return type of this overload + is optional<decltype(f(istd::move(**this))>. +
  • +

space

@@ -1654,8 +1698,7 @@ -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+

Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -146,7 +145,7 @@

- +

Last revised: March 23, 2018 at 23:01:17 GMT

Last revised: June 23, 2018 at 16:25:31 GMT


diff --git a/doc/html/optional/reference.html b/doc/html/optional/reference.html index da63269..d3b0ab7 100644 --- a/doc/html/optional/reference.html +++ b/doc/html/optional/reference.html @@ -75,8 +75,7 @@ -
-
-