config.hpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // config.hpp ---------------------------------------------------------------//
  2. // Copyright 2012 Vicente J. Botet Escriba
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // See http://www.boost.org/LICENSE_1_0.txt
  5. #ifndef BOOST_RATIO_CONFIG_HPP
  6. #define BOOST_RATIO_CONFIG_HPP
  7. #include <boost/config.hpp>
  8. #include <boost/cstdint.hpp>
  9. #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) || !defined(__GXX_EXPERIMENTAL_CXX0X__)
  10. # if ! defined BOOST_NO_CXX11_U16STRING
  11. # define BOOST_NO_CXX11_U16STRING
  12. # endif
  13. # if ! defined BOOST_NO_CXX11_U32STRING
  14. # define BOOST_NO_CXX11_U32STRING
  15. # endif
  16. #endif
  17. #if !defined BOOST_RATIO_VERSION
  18. #define BOOST_RATIO_VERSION 1
  19. #else
  20. #if BOOST_RATIO_VERSION!=1 && BOOST_RATIO_VERSION!=2
  21. #error "BOOST_RATIO_VERSION must be 1 or 2"
  22. #endif
  23. #endif
  24. #if BOOST_RATIO_VERSION==1
  25. #if ! defined BOOST_RATIO_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V2_0_0
  26. #define BOOST_RATIO_PROVIDES_DEPRECATED_FEATURES_SINCE_V2_0_0
  27. #endif
  28. #endif
  29. #if BOOST_RATIO_VERSION==2
  30. #if ! defined BOOST_RATIO_PROVIDES_DEPRECATED_FEATURES_SINCE_V2_0_0
  31. #define BOOST_RATIO_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V2_0_0
  32. #endif
  33. #endif
  34. #ifdef INTMAX_C
  35. #define BOOST_RATIO_INTMAX_C(a) INTMAX_C(a)
  36. #elif __cplusplus >= 201103L
  37. #define BOOST_RATIO_INTMAX_C(a) a##LL
  38. #else
  39. #define BOOST_RATIO_INTMAX_C(a) a##L
  40. #endif
  41. #ifdef UINTMAX_C
  42. #define BOOST_RATIO_UINTMAX_C(a) UINTMAX_C(a)
  43. #elif __cplusplus >= 201103L
  44. #define BOOST_RATIO_UINTMAX_C(a) a##ULL
  45. #else
  46. #define BOOST_RATIO_UINTMAX_C(a) a##UL
  47. #endif
  48. #define BOOST_RATIO_INTMAX_T_MAX (0x7FFFFFFFFFFFFFFELL)
  49. #ifndef BOOST_NO_CXX11_STATIC_ASSERT
  50. #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) static_assert(CND,MSG)
  51. #elif defined(BOOST_RATIO_USES_STATIC_ASSERT)
  52. #include <boost/static_assert.hpp>
  53. #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) BOOST_STATIC_ASSERT(CND)
  54. #elif defined(BOOST_RATIO_USES_MPL_ASSERT)
  55. #include <boost/mpl/assert.hpp>
  56. #include <boost/mpl/bool.hpp>
  57. #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) \
  58. BOOST_MPL_ASSERT_MSG(boost::mpl::bool_< (CND) >::type::value, MSG, TYPES)
  59. #else
  60. //~ #elif defined(BOOST_RATIO_USES_ARRAY_ASSERT)
  61. #define BOOST_RATIO_CONCAT(A,B) A##B
  62. #define BOOST_RATIO_NAME(A,B) BOOST_RATIO_CONCAT(A,B)
  63. #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) static char BOOST_RATIO_NAME(__boost_ratio_test_,__LINE__)[(CND)?1:-1]
  64. //~ #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES)
  65. #endif
  66. #if !defined(BOOST_NO_CXX11_STATIC_ASSERT) || !defined(BOOST_RATIO_USES_MPL_ASSERT)
  67. #define BOOST_RATIO_OVERFLOW_IN_ADD "overflow in ratio add"
  68. #define BOOST_RATIO_OVERFLOW_IN_SUB "overflow in ratio sub"
  69. #define BOOST_RATIO_OVERFLOW_IN_MUL "overflow in ratio mul"
  70. #define BOOST_RATIO_OVERFLOW_IN_DIV "overflow in ratio div"
  71. #define BOOST_RATIO_NUMERATOR_IS_OUT_OF_RANGE "ratio numerator is out of range"
  72. #define BOOST_RATIO_DIVIDE_BY_0 "ratio divide by 0"
  73. #define BOOST_RATIO_DENOMINATOR_IS_OUT_OF_RANGE "ratio denominator is out of range"
  74. #endif
  75. //#define BOOST_RATIO_EXTENSIONS
  76. #endif // header