From 2103e4b05f064f4b9384260f8ef0a91529cadf43 Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Tue, 13 Jun 2023 17:01:55 +0200 Subject: [PATCH] add overloaded helper util for std::visit Signed-off-by: Philipp Jungkamp --- common/include/villas/utils.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/common/include/villas/utils.hpp b/common/include/villas/utils.hpp index 64b7a728b..6736f60b7 100644 --- a/common/include/villas/utils.hpp +++ b/common/include/villas/utils.hpp @@ -194,6 +194,14 @@ bool isContainer(); // Check if the process is running in a privileged environment (has SYS_ADMIN capability). bool isPrivileged(); +// helper type for std::visit +template +struct overloaded : Ts... { using Ts::operator()...; }; + +// explicit deduction guide (not needed as of C++20) +template +overloaded(Ts...) -> overloaded; + namespace base64 { using byte = std::uint8_t;