blob: e1c894c69a24761a1d8a5981a320ea2e4f0cba33 (
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.core: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
|