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

Function sample

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

Source from the content-addressed store, hash-verified

4using namespace matchit;
5
6void sample()
7{
8 constexpr auto pair = std::make_pair(10, "ten");
9 Id<int32_t> a;
10 Id<char const *> b;
11 match(pair)(pattern | ds(a, b) = [&]
12 {
13 assert(*a == 10);
14 assert(*b == std::string_view{"ten"});
15 });
16}
17
18int32_t main()
19{

Callers 1

mainFunction · 0.70

Calls 2

matchFunction · 0.50
dsFunction · 0.50

Tested by

no test coverage detected