Skip to content

Commit

Permalink
Add switch-case macros for all types
Browse files Browse the repository at this point in the history
  • Loading branch information
congard committed Jan 29, 2020
1 parent 9db26e8 commit e13a175
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions include/tulz/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit e13a175

Please sign in to comment.