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

Function isValid

sample/isValid.cpp:4–13  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2#include <iostream>
3
4constexpr bool isValid(int32_t n)
5{
6 using namespace matchit;
7 return match(n)(
8 // clang-format off
9 pattern | or_(1, 3, 5) = expr(true),
10 pattern | _ = expr(false)
11 // clang-format on
12 );
13}
14
15static_assert(isValid(5));
16static_assert(!isValid(6));

Callers 2

isValid.cppFile · 0.85
mainFunction · 0.85

Calls 3

or_Function · 0.85
matchFunction · 0.50
exprFunction · 0.50

Tested by

no test coverage detected