/* boost integer_traits.hpp header file * * Copyright Jens Maurer 2000 * Permission to use, copy, modify, sell, and distribute this software * is hereby granted without fee provided that the above copyright notice * appears in all copies and that both that copyright notice and this * permission notice appear in supporting documentation, * * Jens Maurer makes no representations about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. * * $Id$ * * Idea by Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers */ #ifndef BOOST_INTEGER_TRAITS_HPP #define BOOST_INTEGER_TRAITS_HPP #include #include // These are an implementation detail and not part of the interface #include #ifndef BOOST_NO_INTRINSIC_WCHAR_T #include #endif namespace boost { template class integer_traits : public std::numeric_limits { public: BOOST_STATIC_CONSTANT(bool, is_integral = false); }; namespace detail { template class integer_traits_base { public: BOOST_STATIC_CONSTANT(bool, is_integral = true); BOOST_STATIC_CONSTANT(T, const_min = min_val); BOOST_STATIC_CONSTANT(T, const_max = max_val); }; #ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION // The definition is required even for integral static constants template const T integer_traits_base::const_min; template const T integer_traits_base::const_max; #endif } // namespace detail template<> class integer_traits : public std::numeric_limits, public detail::integer_traits_base { }; template<> class integer_traits : public std::numeric_limits, public detail::integer_traits_base { }; template<> class integer_traits : public std::numeric_limits, public detail::integer_traits_base { }; template<> class integer_traits : public std::numeric_limits, public detail::integer_traits_base { }; #ifndef BOOST_NO_INTRINSIC_WCHAR_T template<> class integer_traits : public std::numeric_limits, #if defined(__BORLANDC__) // Borland C++ does not have WCHAR_MIN and WCHAR_MAX public detail::integer_traits_base #elif defined(__sgi) && (!defined(__SGI_STL_PORT) || __SGI_STL_PORT < 0x400) // SGI MIPSpro with native library doesn't have them, either public detail::integer_traits_base #else public detail::integer_traits_base #endif { }; #endif // BOOST_NO_INTRINSIC_WCHAR_T template<> class integer_traits : public std::numeric_limits, public detail::integer_traits_base { }; template<> class integer_traits : public std::numeric_limits, public detail::integer_traits_base { }; template<> class integer_traits : public std::numeric_limits, public detail::integer_traits_base { }; template<> class integer_traits : public std::numeric_limits, public detail::integer_traits_base { }; template<> class integer_traits : public std::numeric_limits, public detail::integer_traits_base { }; template<> class integer_traits : public std::numeric_limits, public detail::integer_traits_base { }; #ifdef ULLONG_MAX template<> class integer_traits : public std::numeric_limits, public detail::integer_traits_base { }; template<> class integer_traits : public std::numeric_limits, public detail::integer_traits_base { }; #elif defined(ULONG_LONG_MAX) template<> class integer_traits : public std::numeric_limits, public detail::integer_traits_base { }; template<> class integer_traits : public std::numeric_limits, public detail::integer_traits_base { }; #elif defined(ULONGLONG_MAX) template<> class integer_traits : public std::numeric_limits, public detail::integer_traits_base { }; template<> class integer_traits : public std::numeric_limits, public detail::integer_traits_base { }; #endif } // namespace boost #endif /* BOOST_INTEGER_TRAITS_HPP */