| 3 | |
| 4 | template <typename T> |
| 5 | constexpr 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 | |
| 16 | constexpr std::variant<int32_t, char const *> cv = 123; |
| 17 | static_assert(getClassName(cv) == std::string_view{"int32_t"}); |
no test coverage detected