From a2d7181700ac64b8e7a4472ec26dfa253b38f188 Mon Sep 17 00:00:00 2001 From: Lexi Winter Date: Sat, 28 Jun 2025 19:25:55 +0100 Subject: split nihil into separate modules --- nihil.match/match.ccm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 nihil.match/match.ccm (limited to 'nihil.match/match.ccm') diff --git a/nihil.match/match.ccm b/nihil.match/match.ccm new file mode 100644 index 0000000..d67bd0b --- /dev/null +++ b/nihil.match/match.ccm @@ -0,0 +1,23 @@ +/* + * This source code is released into the public domain. + */ + +module; + +#include + +export module nihil.match; + +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