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

Function getClassName

sample/variantAny.cpp:5–14  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3
4template <typename T>
5constexpr auto getClassName(T const &v)
6{
7 using namespace matchit;
8 return match(v)(
9 // clang-format off
10 pattern | as<char const *>(_) = expr("chars"),
11 pattern | as<int32_t>(_) = expr("int32_t")
12 // clang-format on
13 );
14}
15
16constexpr std::variant<int32_t, char const *> cv = 123;
17static_assert(getClassName(cv) == std::string_view{"int32_t"});

Callers 1

variantAny.cppFile · 0.70

Calls 2

matchFunction · 0.50
exprFunction · 0.50

Tested by

no test coverage detected