[C++-sig] Re: Operator== for reflected enums can return True when it shouldn't?

David Abrahams dave at boost-consulting.com
Mon Feb 2 23:44:08 CET 2004


"Pete Bartlett" <pete at pcbartlett.com> writes:

> (Apologies if this issue has been raised before - I must have put the
> wrong search terms into Google)
>
> On my setup (Python 2.3, boost-cvs from early December, MSVC 7.1),
> Python returns True when comparing two reflected enums of different type
> that have the same internal integer representation. Though I am sure it
> is bad Python style to compare different types, would it right and
> possible to return False in this case? 

It depends how you view enums.  Many people use them for simple
constants, and in that case they should behave as C++ enums do, so
they are comparable with other same-valued enums.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list