"Ralf W. Grosse-Kunstleve" <rwgk@xxxxxxxxx> writes:
> --- David Abrahams <dave@xxxxxxxxxxxxxxxxxxxx> wrote:
>> > I.e. the trick is to compare boost::python::type_info(typeid(X)).
>> if ( boost::is_same< std::size_t, unsigned >() )
>> would be a whole lot cleaner, and would often generate less code since
>> the check can be made at compile-time.
> I see. Thanks!
> I chose the boost::python::type_info(typeid(X)) approach because this is
> exactly how the Boost.Python registry determines equivalence.
Well, you should be using type_id<X>() rather than writing it out
> boost/python/type_id.hpp has all kinds of platform-specific adjustments, e.g.
> the "signed int" vs. "int" workaround for "Older EDG-based compilers". Is it
> safe to assume that boost::is_same<> is true if and only if
> boost::python::type_info instances compare equal?
Except on implementations that we can effectively consider buggy, yes.
C++-sig mailing list