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

Function sample1

sample/Slice-pattern.cpp:6–13  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4using namespace matchit;
5
6void sample1()
7{
8 // Fixed size
9 constexpr auto arr = std::array<int32_t, 3>{1, 2, 3};
10 Id<int32_t> a, b, c;
11 match(arr)(pattern | ds(1, _, _) = expr("starts with one"),
12 pattern | ds(a, b, c) = expr("starts with something else"));
13}
14
15void sample2()
16{

Callers 1

mainFunction · 0.70

Calls 3

matchFunction · 0.50
dsFunction · 0.50
exprFunction · 0.50

Tested by

no test coverage detected