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

Function sample

sample/Reference-pattern.cpp:5–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3using namespace matchit;
4
5void sample()
6{
7 int32_t const value = 3;
8 int32_t const *int_reference = &value;
9
10 int32_t const zero = 0;
11
12 auto const a = match(*int_reference)(pattern | zero = expr("zero"),
13 pattern | _ = expr("some"));
14
15 auto const b = match(int_reference)(pattern | &zero = expr("zero"),
16 pattern | _ = expr("some"));
17
18 static_cast<void>(a);
19 static_cast<void>(b);
20
21 assert(a == b);
22}
23
24int32_t main()
25{

Callers 1

mainFunction · 0.70

Calls 2

matchFunction · 0.50
exprFunction · 0.50

Tested by

no test coverage detected