src/macros.h

changeset 1033
32153a1dbb15
parent 1017
fc1c13db9618
child 1034
a05fc8256a3a
--- a/src/macros.h	Sun May 08 13:25:12 2016 +0300
+++ b/src/macros.h	Sun May 08 15:26:58 2016 +0300
@@ -43,7 +43,8 @@
 #define dvalof(A) dprint ("value of '%1' = %2\n", #A, A)
 #define for_axes(AX) for (const Axis AX : std::initializer_list<const Axis> ({X, Y, Z}))
 
-#define MAKE_ITERABLE_ENUM(T) \
+#define MAKE_ITERABLE_ENUM(T, FIRST, LAST) \
+	namespace EnumLimits { namespace T { enum { First = FIRST, Last = LAST, Count = LAST - FIRST + 1 }; } } \
 	inline T operator++ (T& a) { a = (T) ((int) a + 1); return a; } \
 	inline T operator-- (T& a) { a = (T) ((int) a - 1); return a; } \
 	inline T operator++ (T& a, int) { T result = a; a = (T) ((int) a + 1); return result; } \

mercurial