From 5adeb648f74c1771164c0686d6e0fc584cf36d9e Mon Sep 17 00:00:00 2001 From: Lexi Winter Date: Wed, 2 Jul 2025 04:00:06 +0100 Subject: move everything from util to core --- nihil.core/match.ccm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 nihil.core/match.ccm (limited to 'nihil.core/match.ccm') diff --git a/nihil.core/match.ccm b/nihil.core/match.ccm new file mode 100644 index 0000000..e1c894c --- /dev/null +++ b/nihil.core/match.ccm @@ -0,0 +1,18 @@ +// This source code is released into the public domain. +export module nihil.core:match; + +import nihil.std; + +namespace nihil { + +export template +struct match : Ts... { using Ts::operator()...; }; + +export template +[[nodiscard]] constexpr decltype(auto) operator| + (std::variant const &v, match const &match) +{ + return std::visit(match, v); +} + +} // namespace nihil -- cgit v1.2.3