This commit is contained in:
Simon Brand
2018-11-10 09:31:56 +00:00
parent e5ec75909c
commit 08b39b8042
2 changed files with 11 additions and 1 deletions

View File

@ -91,3 +91,13 @@ TEST_CASE("Issue 34", "[issues.34]") {
.and_then (work2);
result.map_error ([&] (std::string result) {errorhandling (result);});
}
struct non_copyable {
non_copyable(non_copyable&&) = default;
non_copyable(non_copyable const&) = delete;
non_copyable() = default;
};
TEST_CASE("Issue 42", "[issues.42]") {
tl::expected<non_copyable,int>{}.map([](non_copyable) {});
}

View File

@ -1301,7 +1301,7 @@ public:
/// \synopsis template <class F> constexpr auto map(F &&f) &&;
template <class F>
TL_EXPECTED_11_CONSTEXPR decltype(
expected_map_impl(std::declval<expected &>(), std::declval<F &&>()))
expected_map_impl(std::declval<expected>(), std::declval<F &&>()))
map(F &&f) && {
return expected_map_impl(std::move(*this), std::forward<F>(f));
}