Skip to content

Instantly share code, notes, and snippets.

@onqtam
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onqtam/b70516dc17723d2b1ef7 to your computer and use it in GitHub Desktop.
Save onqtam/b70516dc17723d2b1ef7 to your computer and use it in GitHub Desktop.
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
using namespace std;
enum class Crap {
A = 0,
B,
C,
Count
};
Crap& operator++(Crap& c) {
c = static_cast<Crap>(static_cast<int>(c) + 1);
return c;
}
Crap operator++(Crap& orig, int)
{
Crap rVal = orig;
++orig;
return rVal;
}
int main() {
for(Crap c = Crap::A; c != Crap::Count; c++)
cout << "wohoo" << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment