From ab82cc7f87ae32cbca7022a48772e3fb81a10473 Mon Sep 17 00:00:00 2001 From: mes5k Date: Fri, 23 Oct 2009 21:42:43 +0000 Subject: [PATCH] added a check for wchar_t to deal with a potential problem with MS compilers --- include/tclap/StandardTraits.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/tclap/StandardTraits.h b/include/tclap/StandardTraits.h index 8be880e..f63ed65 100644 --- a/include/tclap/StandardTraits.h +++ b/include/tclap/StandardTraits.h @@ -30,6 +30,15 @@ #include // To check for long long #endif +// If Microsoft has already typedef'd wchar_t as an unsigned +// short, then compiles will break because it's as if we're +// creating ArgTraits twice for unsigned short. Thus... +#ifdef _MSC_VER +#ifndef _NATIVE_WCHAR_T_DEFINED +#define TCLAP_DONT_DECLARE_WCHAR_T_ARGTRAITS +#endif +#endif + namespace TCLAP { // ====================================================================== @@ -156,13 +165,16 @@ struct ArgTraits { typedef ValueLike ValueCategory; }; + /** * wchar_ts have value-like semantics. */ +#ifndef TCLAP_DONT_DECLARE_WCHAR_T_ARGTRAITS template<> struct ArgTraits { typedef ValueLike ValueCategory; }; +#endif /** * Strings have string like argument traits.