From 76bac80dde1aaeb9fa4865ae7e34212a040a3d89 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Fri, 24 Aug 2018 00:31:48 +0300 Subject: [PATCH] Add MATCH macro --- Utilities/types.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Utilities/types.h b/Utilities/types.h index d0bc1e6071..25508f9c06 100644 --- a/Utilities/types.h +++ b/Utilities/types.h @@ -45,6 +45,9 @@ // Return 32 bit alignof() to avoid widening/narrowing conversions with size_t #define ALIGN_32(...) static_cast(alignof(__VA_ARGS__)) +// Variant pattern matching helper +#define MATCH(arg, ...) constexpr(std::is_same_v, __VA_ARGS__>) + #define CONCATENATE_DETAIL(x, y) x ## y #define CONCATENATE(x, y) CONCATENATE_DETAIL(x, y)