Hello
I have a simple enumeration:
Now I want to compare enum with integer.Code:enum simple { one = 1, two, three };
Is this a proper way of doing this or it would be better to cast simpe enum to int (with static cast) before comparing it with integer:Code:bool compare(simple e) { int someint = 2; return (someint == e) ? true : false; }
where e is simple enum datatype.Code:int casted = std::static_cast<int>(e);
Many thanks in advance!



LinkBack URL
About LinkBacks




CornedBee
No, actually I was thinking you wanted to compare to all the enums or something, rather than one specific one.