Boost logo

Boost :

From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2003-04-25 11:28:21


On Fri, 25 Apr 2003 11:25:15 -0400, David Abrahams
<dave_at_[hidden]> wrote:

>OK, what if it were changed to:
>
># if !(defined(_WCHAR_T_DEFINED) || defined(_NATIVE_WCHAR_T_DEFINED))
># define BOOST_NO_INTRINSIC_WCHAR_T
># endif
>
>??

No. I don't know if the meaning of _WCHAR_T_DEFINED has been changed
with the latest VC and/or Intel but certainly the above doesn't work
with version 6, of both compilers. The point is that _WCHAR_T_DEFINED
isn't actually an indicator of intrinsic-ness; it gets, for instance,
manually defined in the library headers:

 #ifndef _WCHAR_T_DEFINED
 typedef unsigned short wchar_t;
 #define _WCHAR_T_DEFINED
 #endif

Client code assumes that wchar_t is a distinct type, unless
BOOST_NO_INTRINSIC_WCHAR_T is defined. So the above change would break
the typical usage:

  template <typename T>
  struct is_integral
  { static const bool value = false; };

  template <>
  struct is_integral<unsigned short>
  { static const bool value = true; };

#if !defined NO_INTRINSIC_WCHAR_T

 // Oops... _WCHAR_T_DEFINED is defined,
 // but you can't (re-)specialize

 template <>
 struct is_integral<wchar_t>
 { static const bool value = true; };

#endif

Genny.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk