Fix map for reference types

This commit is contained in:
Simon Brand
2018-02-11 09:32:35 +00:00
parent 14cfd77197
commit 4bde006cb5
2 changed files with 67 additions and 59 deletions

View File

@@ -125,6 +125,11 @@ TEST_CASE("Monadic operations", "[monadic]") {
auto o38r = o38.map([](int &i) -> const int & { return i; });
REQUIRE(o38r);
REQUIRE(*o38r == 42);
int i = 42;
tl::optional<int&> o39 = i;
o39.map([](int& x){x = 12;});
REQUIRE(i == 12);
}
SECTION("map constexpr") {