c++-sig@python.org
[Top] [All Lists]

Re: [C++-sig] wrapping typedef equivalent types

Subject: Re: [C++-sig] wrapping typedef equivalent types
From: David Abrahams
Date: Fri, 21 Oct 2005 08:46:20 -0400
"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
longhand.

> 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.

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

_______________________________________________
C++-sig mailing list
C++-sig@xxxxxxxxxx
http://mail.python.org/mailman/listinfo/c++-sig

<Prev in Thread] Current Thread [Next in Thread>