Last active
November 24, 2015 19:50
-
-
Save warmist/711522d79a8c327bac8f to your computer and use it in GitHub Desktop.
Automatic enumeration iteration generation formation C++'ination.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define enum_helper(type_name,first,last) type_name operator++(type_name & x) {return x = type_name(std::underlying_type<type_name>::type(x) + 1); }\ | |
type_name operator*(type_name c) {return c;}\ | |
type_name begin(type_name r) {return type_name:: first;}\ | |
type_name end(type_name r) {return type_name:: last;} | |
enum class thingy | |
{ | |
a,b,c,d,e,f,g | |
}; | |
enum_helper(thingy,a,g) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment