MCPcopy Create free account
hub / github.com/BowenFu/matchit.cpp / sample1

Function sample1

sample/Identifier-pattern.cpp:6–16  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4using namespace matchit;
5
6void sample1()
7{
8 constexpr auto x = 2;
9 Id<int32_t> e;
10 match(x)(
11 // clang-format off
12 pattern | e.at(1 <= _ && _ <= 5) = [&] { std::cout << "got a range element " << *e << std::endl; },
13 pattern | _ = [&] { std::cout << "anything" << std::endl; }
14 // clang-format on
15 );
16}
17
18struct Person
19{

Callers 1

mainFunction · 0.70

Calls 2

matchFunction · 0.50
atMethod · 0.45

Tested by

no test coverage detected