blob: b72416a1a6cde044bb18694d7023a1d7c6f4910d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
// This source code is released into the public domain.
export module nihil.util:match;
import nihil.std;
namespace nihil {
export template<class... Ts>
struct match : Ts... { using Ts::operator()...; };
export template<typename... Ts, typename... Fs>
[[nodiscard]] constexpr decltype(auto) operator|
(std::variant<Ts...> const &v, match<Fs...> const &match)
{
return std::visit(match, v);
}
} // namespace nihil
|