Boost logo

Boost :

From: Daryle Walker (dwalker07_at_[hidden])
Date: 2003-06-05 01:10:59

On Wednesday, June 4, 2003, at 3:54 PM, Beman Dawes wrote:

> Hum... I just had a thought. Is it possible to detect if wchar_t is a
> typedef at compile time?
> Yes, I think so. Won't boost::is_same< unsigned short, wchar_t
> >::value be true if wchar_t is a typedef, and false if a distinct > type?
> I'll do some experiments.

The method you gave may not work. Who says that "unsigned short" is
the type that "wchar_t" rips off? What about something like:

// If wchar_t is a distinct type, this version will be used
template < typename T >
struct my_tester
     BOOST_STATIC_CONSTANT( bool, value = false );

// Do this specialization for every built-in integral type
// EXCEPT wchar_t
template < >
struct my_tester< bool >
     BOOST_STATIC_CONSTANT( bool, value = true );


int main()
     return my_tester<wchar_t>::value;


Boost list run by bdawes at, gregod at, cpdaniel at, john at