문제

why aren't instances of strongly typed C++0x enumerations comparable to each other?


Update: They are comparable in gcc 4.6; I'm not sure if it worked in gcc 4.4.

도움이 되었습니까?

해결책

If you use strongly typed enumerations, it's like making your enum a realy type, a class. Then it follows the same rules as for classes.

Instances of different classes can't be compared to each other by default. You have to define a comparison function (or member function) to make them comparable.

Therefore making an enumeration strongly typed makes it follows this very same rule.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top