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

Function main

sample/Matching-Tuples.cpp:5–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3#include <tuple>
4
5int32_t main()
6{
7 using namespace matchit;
8 constexpr auto p = std::make_tuple(4, 6);
9 Id<int32_t> x, y;
10 match(p)(
11 // clang-format off
12 pattern | ds(0, 0) = [&]{ std::cout << "on origin"; },
13 pattern | ds(0, y) = [&]{ std::cout << "on y-axis"; },
14 pattern | ds(x, 0) = [&]{ std::cout << "on x-axis"; },
15 pattern | ds(x, y) = [&]{ std::cout << *x << ',' << *y; }
16 // clang-format on
17 );
18
19 return 0;
20}

Callers

nothing calls this directly

Calls 2

matchFunction · 0.50
dsFunction · 0.50

Tested by

no test coverage detected