From a970526e4bd31dab272188107990704969d529db Mon Sep 17 00:00:00 2001 From: sha512sum Date: Tue, 27 Feb 2024 18:40:00 +0000 Subject: [PATCH] Add overloaded --- include/utempl/overloaded.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 include/utempl/overloaded.hpp diff --git a/include/utempl/overloaded.hpp b/include/utempl/overloaded.hpp new file mode 100644 index 0000000..ae8b3a4 --- /dev/null +++ b/include/utempl/overloaded.hpp @@ -0,0 +1,13 @@ +#pragma once +#include + +namespace utempl { +template +inline constexpr auto Overloaded(Fs&&... fs) { + struct Overloaded : public std::remove_cvref_t... { + using Fs::operator()...; + }; + return Overloaded{std::forward(fs)...}; +}; + +} // namespace utempl