blob: 03730bb9cce087d989e8b988f4000fd7059eebb1 (
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.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
|