1 // Copyright John Maddock 2009. 2 // Distributed under the Boost 3 // Software License, Version 1.0. (See accompanying file 4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 6 #include <boost/integer_traits.hpp> // must be the only #include! 7 8 template <class T> check_numeric_limits_derived(const std::numeric_limits<T> &)9void check_numeric_limits_derived(const std::numeric_limits<T>&){} 10 11 template <class T> check()12void check() 13 { 14 typedef boost::integer_traits<T> traits; 15 check_numeric_limits_derived(traits()); 16 bool b = traits::is_integral; 17 (void)b; 18 T v = traits::const_min + traits::const_max; 19 (void)v; 20 } 21 main()22int main() 23 { 24 check<signed char>(); 25 check<unsigned char>(); 26 check<char>(); 27 check<short>(); 28 check<unsigned short>(); 29 check<int>(); 30 check<unsigned int>(); 31 check<signed long>(); 32 check<unsigned long>(); 33 #if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) 34 check<boost::long_long_type>(); 35 check<boost::ulong_long_type>(); 36 #endif 37 } 38