Quick actions

cmd+k|ctrl+k

Navigation

Languages

Loop over enum

Snippet info

Language

Cpp

Visibility

public

Author

evine

Created

2018-02-14T21:57:16Z

Updated

2018-02-14T21:57:16Z

#include <stdio.h>
#include <stdint.h>

#define forI(type, name, count) \
for(type name = {}; name < (count); *(int64_t *)&name += 1)

enum struct Thing{
    a,b,c,
    Total
};

int main() {
    forI(Thing, i, Thing::Total)
        printf("Hello World!\n");
    return 0;
}
INFO