Commit 05b61ecf authored by neverlord's avatar neverlord

pattern matching

parent 8f393dc7
...@@ -1138,13 +1138,16 @@ size_t test__tuple() ...@@ -1138,13 +1138,16 @@ size_t test__tuple()
auto f10 = auto f10 =
( (
_on<int>().when(_x1 < 10) >> [&]() { invoked = "f10.0"; }, _on<int>().when(_x1 < 10) >> [&]() { invoked = "f10.0"; },
_on<int>() >> [&]() { invoked = "f10.1"; } _on<int>() >> [&]() { invoked = "f10.1"; },
_on<std::string>() >> [&]() { invoked = "f10.2"; }
); );
CPPA_CHECK(f10(9)); CPPA_CHECK(f10(9));
CPPA_CHECK_EQUAL("f10.0", invoked); CPPA_CHECK_EQUAL("f10.0", invoked);
CPPA_CHECK(f10(10)); CPPA_CHECK(f10(10));
CPPA_CHECK_EQUAL("f10.1", invoked); CPPA_CHECK_EQUAL("f10.1", invoked);
CPPA_CHECK(f10("42"));
CPPA_CHECK_EQUAL("f10.2", invoked);
int f11_fun = 0; int f11_fun = 0;
auto f11 = pj_concat auto f11 = pj_concat
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment