and the obligatory fixup for C++-11 :-)

This commit is contained in:
Bj?rn Fahller
2018-06-03 15:01:57 +02:00
parent 5143f9577a
commit e8b28f2e34

View File

@ -1757,12 +1757,12 @@ public:
/// \group and_then
/// \synopsis template <class F>\nconstexpr auto and_then(F &&f) &&;
template <class F>
TL_OPTIONAL_11_CONSTEXPR detail::invoke_result_t<F, T &&> and_then(F &&f) && {
using result = detail::invoke_result_t<F, T &&>;
TL_OPTIONAL_11_CONSTEXPR detail::invoke_result_t<F, T &> and_then(F &&f) && {
using result = detail::invoke_result_t<F, T &>;
static_assert(detail::is_optional<result>::value,
"F must return an optional");
return has_value() ? detail::invoke(std::forward<F>(f), std::move(**this))
return has_value() ? detail::invoke(std::forward<F>(f), **this)
: result(nullopt);
}
@ -1782,12 +1782,12 @@ public:
/// \group and_then
/// \synopsis template <class F>\nconstexpr auto and_then(F &&f) const &&;
template <class F>
constexpr detail::invoke_result_t<F, const T &&> and_then(F &&f) const && {
using result = detail::invoke_result_t<F, const T &&>;
constexpr detail::invoke_result_t<F, const T &> and_then(F &&f) const && {
using result = detail::invoke_result_t<F, const T &>;
static_assert(detail::is_optional<result>::value,
"F must return an optional");
return has_value() ? detail::invoke(std::forward<F>(f), std::move(**this))
return has_value() ? detail::invoke(std::forward<F>(f), **this)
: result(nullopt);
}
#endif