Skip to content

Instantly share code, notes, and snippets.

@Klowner
Created March 15, 2017 23:23
Show Gist options
  • Save Klowner/a3d496f9000246823810f7fba465de79 to your computer and use it in GitHub Desktop.
Save Klowner/a3d496f9000246823810f7fba465de79 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
#include <vector>
#define DEF(_name_) _name_,
typedef enum {
#include "types_defs.h"
MAX_TYPES,
} Types;
#undef DEF
#define DEF(_name_) #_name_,
std::vector<std::string> typeNames = {
#include "types_defs.h"
};
#undef DEF
int main() {
for (int i=0; i<MAX_TYPES; ++i)
{
std::cout << i << ' ' << typeNames[i] << '\n';
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment