added o.map()

This commit is contained in:
Andrzej Krzemienski
2018-06-23 18:27:14 +02:00
parent 5182f7f30f
commit e47a017009
50 changed files with 343 additions and 91 deletions

View File

@ -685,6 +685,25 @@ __SPACE__
__SPACE__
[#reference_optional_map]
[: `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__
[#reference_optional_map_move]
[: `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__
[#reference_optional_get_value_or_value]
[: `T const& optional<T>::get_value_or( T const& default) const ;`]