boost_no_limits_const_exp.ipp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // (C) Copyright John Maddock 2001.
  2. // Use, modification and distribution are subject to the
  3. // Boost 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. // See http://www.boost.org/libs/config for most recent version.
  6. // MACRO: BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
  7. // TITLE: compile time constants in <limits>
  8. // DESCRIPTION: constants such as numeric_limits<T>::is_signed
  9. // are not available for use at compile-time.
  10. #include <limits>
  11. namespace boost_no_limits_compile_time_constants{
  12. struct UDT{};
  13. template <int i>
  14. struct assert_ice
  15. {
  16. enum { value = i };
  17. };
  18. int test()
  19. {
  20. assert_ice< ::std::numeric_limits<int>::is_signed > one;
  21. assert_ice< ::std::numeric_limits<double>::is_specialized > two;
  22. assert_ice< ::std::numeric_limits<UDT>::is_specialized > three;
  23. assert_ice< ::std::numeric_limits<UDT>::is_signed > four;
  24. (void)one;
  25. (void)two;
  26. (void)three;
  27. (void)four;
  28. return 0;
  29. }
  30. }