Trying to get this enumclass working, but keep getting
'does not name a type' error.
1 2 3 4 5 6 7
class A
{
public:
enumclass States {current, taco, burrito};
virtual States stateChange() = 0;
};
Also claiming 'error: expected identifier before ',' token' and then points to the second comma in my enum list.
I've never really used enums as I haven't had much use for them before.
Sorry for the lack of pastes btw, I'm working on two separate computers and for some reason didn't think of opening Chrome on the computer with the code -_-
Wow figured. The include guard in the file using this class was missing a letter -_-
That should be really easy to spot. "#define" and "#ifndef" have exactly the same number of letters, so the symbol you're using for your header guard should line up exactly in those two lines:
I can't actually think of any compilers off the top of my head that DON'T support it...
It doesn't do the same thing as header guards if the header is copied or linked. It is also very hard to specify portably, since it deals with filesystem-level concepts (inode, FileIndex, etc)
I usually have both #define/#ifndef and #pragma once, simply because visual studio 2010 doesn't want to compile files which don't have either #include something or #pragma something - and I often have small objects which don't require includes.