From e8b28f2e34e58a3bcb6e68a24c6aa311ec6fe30a Mon Sep 17 00:00:00 2001 From: Bj?rn Fahller Date: Sun, 3 Jun 2018 15:01:57 +0200 Subject: [PATCH] and the obligatory fixup for C++-11 :-) --- tl/optional.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tl/optional.hpp b/tl/optional.hpp index 35354b3..bc72352 100644 --- a/tl/optional.hpp +++ b/tl/optional.hpp @@ -1757,12 +1757,12 @@ public: /// \group and_then /// \synopsis template \nconstexpr auto and_then(F &&f) &&; template - TL_OPTIONAL_11_CONSTEXPR detail::invoke_result_t and_then(F &&f) && { - using result = detail::invoke_result_t; + TL_OPTIONAL_11_CONSTEXPR detail::invoke_result_t and_then(F &&f) && { + using result = detail::invoke_result_t; static_assert(detail::is_optional::value, "F must return an optional"); - return has_value() ? detail::invoke(std::forward(f), std::move(**this)) + return has_value() ? detail::invoke(std::forward(f), **this) : result(nullopt); } @@ -1782,12 +1782,12 @@ public: /// \group and_then /// \synopsis template \nconstexpr auto and_then(F &&f) const &&; template - constexpr detail::invoke_result_t and_then(F &&f) const && { - using result = detail::invoke_result_t; + constexpr detail::invoke_result_t and_then(F &&f) const && { + using result = detail::invoke_result_t; static_assert(detail::is_optional::value, "F must return an optional"); - return has_value() ? detail::invoke(std::forward(f), std::move(**this)) + return has_value() ? detail::invoke(std::forward(f), **this) : result(nullopt); } #endif