diff --git a/numeric_traits_test.cpp b/numeric_traits_test.cpp index 3b169bf..662f19f 100644 --- a/numeric_traits_test.cpp +++ b/numeric_traits_test.cpp @@ -7,6 +7,7 @@ // See http://www.boost.org for most recent version including documentation. // Revision History +// 1 Apr 2001 Fixes for ICL; use BOOST_STATIC_CONSTANT // 11 Feb 2001 Fixes for Borland (David Abrahams) // 23 Jan 2001 Added test for wchar_t (David Abrahams) // 23 Jan 2001 Now statically selecting a test for signed numbers to avoid @@ -30,13 +31,6 @@ # include #endif -// A macro for declaring class compile-time constants. -#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION -# define DECLARE_CLASS_CONST(type, init) static const type init -#else -# define DECLARE_CLASS_CONST(type, init) enum { init } -#endif - // ================================================================================= // template class complement_traits -- // @@ -53,8 +47,8 @@ template struct complement; // forward template struct complement_traits_aux { - DECLARE_CLASS_CONST(Number, max = complement::template traits::max); - DECLARE_CLASS_CONST(Number, min = complement::template traits::min); + BOOST_STATIC_CONSTANT(Number, max = complement::template traits::max); + BOOST_STATIC_CONSTANT(Number, min = complement::template traits::min); }; template @@ -67,11 +61,11 @@ struct complement // indirection through complement_traits_aux neccessary to keep MSVC happy typedef complement_traits_aux prev; public: - DECLARE_CLASS_CONST(Number, max = + BOOST_STATIC_CONSTANT(Number, max = Number(Number(prev::max) << CHAR_BIT) + Number(UCHAR_MAX)); - DECLARE_CLASS_CONST(Number, min = Number(Number(prev::min) << CHAR_BIT)); + BOOST_STATIC_CONSTANT(Number, min = Number(Number(prev::min) << CHAR_BIT)); }; }; @@ -85,8 +79,8 @@ template <> struct complement_base template struct values { - DECLARE_CLASS_CONST(Number, min = 0); - DECLARE_CLASS_CONST(Number, max = UCHAR_MAX); + BOOST_STATIC_CONSTANT(Number, min = 0); + BOOST_STATIC_CONSTANT(Number, max = UCHAR_MAX); }; }; @@ -95,8 +89,8 @@ template <> struct complement_base template struct values { - DECLARE_CLASS_CONST(Number, min = SCHAR_MIN); - DECLARE_CLASS_CONST(Number, max = SCHAR_MAX); + BOOST_STATIC_CONSTANT(Number, min = SCHAR_MIN); + BOOST_STATIC_CONSTANT(Number, max = SCHAR_MAX); }; }; @@ -107,10 +101,10 @@ struct complement<1> template struct traits { - DECLARE_CLASS_CONST(bool, is_signed = boost::detail::is_signed::value); - DECLARE_CLASS_CONST(Number, min = + BOOST_STATIC_CONSTANT(bool, is_signed = boost::detail::is_signed::value); + BOOST_STATIC_CONSTANT(Number, min = complement_base::template values::min); - DECLARE_CLASS_CONST(Number, max = + BOOST_STATIC_CONSTANT(Number, max = complement_base::template values::max); }; }; @@ -121,8 +115,8 @@ struct complement<1> template struct complement_traits { - DECLARE_CLASS_CONST(Number, max = (complement_traits_aux::max)); - DECLARE_CLASS_CONST(Number, min = (complement_traits_aux::min)); + BOOST_STATIC_CONSTANT(Number, max = (complement_traits_aux::max)); + BOOST_STATIC_CONSTANT(Number, min = (complement_traits_aux::min)); }; // ================================================================================= @@ -151,9 +145,9 @@ template <> struct stream_as { typedef unsigned char t1; typedef unsigned t2; }; -#if defined(BOOST_MSVC) // No intmax streaming built-in +#if defined(BOOST_MSVC_STD_ITERATOR) // No intmax streaming built-in -// On this platform, __int64 and __uint64 get streamed as strings +// With this library implementation, __int64 and __uint64 get streamed as strings template <> struct stream_as { typedef std::string t1; typedef std::string t2; @@ -174,7 +168,7 @@ template struct promote } }; -#if defined(BOOST_MSVC) // No intmax streaming built-in +#if defined(BOOST_MSVC_STD_ITERATOR) // No intmax streaming built-in // On this platform, stream them as long/unsigned long if they fit. // Otherwise, write a string.