Fix map for reference types
This commit is contained in:
1 parent
14cfd77197
commit
4bde006cb5
2 files changed
+67
-59
No files matched your search
@@ -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") {
|
||||
|
||||
Reference in new issue
Block a user