From 2be61898ff31a7ada524a1fa06be30ddb4b78a22 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 22 Dec 2023 01:22:49 -0800 Subject: Use std::visit instead of manually checking the set type --- al/eax/effect.h | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/al/eax/effect.h b/al/eax/effect.h index afe4d94d..14506846 100644 --- a/al/eax/effect.h +++ b/al/eax/effect.h @@ -296,31 +296,21 @@ public: #define EAXCALL(Props, Callable, ...) \ - if(std::holds_alternative(Props)) \ - return Callable(__VA_ARGS__); \ - if(std::holds_alternative(Props)) \ - return Callable(__VA_ARGS__); \ - if(std::holds_alternative(Props)) \ - return Callable(__VA_ARGS__); \ - if(std::holds_alternative(Props)) \ - return Callable(__VA_ARGS__); \ - if(std::holds_alternative(Props)) \ - return Callable(__VA_ARGS__); \ - if(std::holds_alternative(Props)) \ - return Callable(__VA_ARGS__); \ - if(std::holds_alternative(Props)) \ - return Callable(__VA_ARGS__); \ - if(std::holds_alternative(Props)) \ - return Callable(__VA_ARGS__); \ - if(std::holds_alternative(Props)) \ - return Callable(__VA_ARGS__); \ - if(std::holds_alternative(Props)) \ - return Callable(__VA_ARGS__); \ - if(std::holds_alternative(Props)) \ - return Callable(__VA_ARGS__); \ - if(std::holds_alternative(Props)) \ - return Callable(__VA_ARGS__); \ - return Callable(__VA_ARGS__) + return std::visit(overloaded{ \ + [&](const std::monostate&) { return Callable(__VA_ARGS__); }, \ + [&](const EAXREVERBPROPERTIES&) { return Callable(__VA_ARGS__); }, \ + [&](const EAXCHORUSPROPERTIES&) { return Callable(__VA_ARGS__); }, \ + [&](const EAXAUTOWAHPROPERTIES&) { return Callable(__VA_ARGS__); }, \ + [&](const EAXAGCCOMPRESSORPROPERTIES&) { return Callable(__VA_ARGS__); }, \ + [&](const EAXDISTORTIONPROPERTIES&) { return Callable(__VA_ARGS__); }, \ + [&](const EAXECHOPROPERTIES&) { return Callable(__VA_ARGS__); }, \ + [&](const EAXEQUALIZERPROPERTIES&) { return Callable(__VA_ARGS__); }, \ + [&](const EAXFLANGERPROPERTIES&) { return Callable(__VA_ARGS__); }, \ + [&](const EAXFREQUENCYSHIFTERPROPERTIES&) { return Callable(__VA_ARGS__); }, \ + [&](const EAXRINGMODULATORPROPERTIES&) { return Callable(__VA_ARGS__); }, \ + [&](const EAXPITCHSHIFTERPROPERTIES&) { return Callable(__VA_ARGS__); }, \ + [&](const EAXVOCALMORPHERPROPERTIES&) { return Callable(__VA_ARGS__); } \ + }, Props) template static void call_set(Args&& ...args) -- cgit v1.2.3