From e13a175154bd08cca1ce8878789bf7a7c40eb496 Mon Sep 17 00:00:00 2001 From: Daniel Bernar Date: Wed, 29 Jan 2020 14:09:16 +0200 Subject: [PATCH] Add switch-case macros for all types --- include/tulz/macros.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/tulz/macros.h b/include/tulz/macros.h index d6feb60..3d0d694 100644 --- a/include/tulz/macros.h +++ b/include/tulz/macros.h @@ -5,4 +5,18 @@ #define deletePtrArray(ptr) if (ptr != nullptr) { delete[] ptr; ptr = nullptr; } #define getArraySize(array) (sizeof(array) / sizeof(array[0])) +#define switch_t(_val) \ +{ \ + const auto &__val = _val; \ + if (false); + +#define case_t(_val) \ + else if (__val == _val) + +#define default_t \ + else + +#define switch_t_end \ +} + #endif //TULZ_MACROS_H