We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cf05829 commit 1d93a02Copy full SHA for 1d93a02
include/beman/optional/optional.hpp
@@ -818,7 +818,7 @@ constexpr auto optional<T>::transform(F&& f) const&& {
818
static_assert(!std::is_same_v<U, in_place_t>);
819
static_assert(!std::is_same_v<U, nullopt_t>);
820
static_assert(std::is_object_v<U> || std::is_reference_v<U>); /// References now allowed
821
- return (has_value()) ? optional<U>{std::invoke(std::forward<F>(f), value_)} : optional<U>{};
+ return (has_value()) ? optional<U>{std::invoke(std::forward<F>(f), std::move(value_))} : optional<U>{};
822
}
823
824
/// Calls `f` if the optional is empty
0 commit comments