mirror of
https://github.com/TartanLlama/optional.git
synced 2025-08-03 20:04:26 +02:00
Support GCC 4.8
This commit is contained in:
@@ -374,18 +374,18 @@ SECTION("conjunction") {
|
||||
|
||||
SECTION("map_or") {
|
||||
tl::optional<int> o1 = 21;
|
||||
REQUIRE((o1.map_or([](auto x) { return x * 2; }, 13)) == 42);
|
||||
REQUIRE((o1.map_or([](int x) { return x * 2; }, 13)) == 42);
|
||||
|
||||
tl::optional<int> o2;
|
||||
REQUIRE((o2.map_or([](auto x) { return x * 2; }, 13)) == 13);
|
||||
REQUIRE((o2.map_or([](int x) { return x * 2; }, 13)) == 13);
|
||||
}
|
||||
|
||||
SECTION("map_or_else") {
|
||||
tl::optional<int> o1 = 21;
|
||||
REQUIRE((o1.map_or_else([](auto x) { return x * 2; }, []{return 13;})) == 42);
|
||||
REQUIRE((o1.map_or_else([](int x) { return x * 2; }, []{return 13;})) == 42);
|
||||
|
||||
tl::optional<int> o2;
|
||||
REQUIRE((o2.map_or_else([](auto x) { return x * 2; }, []{return 13;})) == 13);
|
||||
REQUIRE((o2.map_or_else([](int x) { return x * 2; }, []{return 13;})) == 13);
|
||||
}
|
||||
|
||||
SECTION("take") {
|
||||
|
@@ -22,8 +22,11 @@ TEST_CASE("Observers", "[observers]") {
|
||||
REQUIRE(success);
|
||||
success = std::is_same<decltype(std::move(o1).value()), int &&>::value;
|
||||
REQUIRE(success);
|
||||
|
||||
#ifndef TL_OPTIONAL_NO_CONSTRR
|
||||
success = std::is_same<decltype(std::move(o3).value()), const int &&>::value;
|
||||
REQUIRE(success);
|
||||
#endif
|
||||
|
||||
tl::optional<move_detector> o4{tl::in_place};
|
||||
move_detector o5 = std::move(o4).value();
|
||||
|
Reference in New Issue
Block a user