[C++-sig] wrapping typedef equivalent types

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Fri Oct 21 13:17:11 CEST 2005


--- David Abrahams <dave at boost-consulting.com> 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.
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?

Cheers,
        Ralf



		
__________________________________ 
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com



More information about the Cplusplus-sig mailing list