config.hpp 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. #else
  37. #define BOOST_RATIO_INTMAX_C(a) a##LL
  38. #endif
  39. #ifdef UINTMAX_C
  40. #define BOOST_RATIO_UINTMAX_C(a) UINTMAX_C(a)
  41. #else
  42. #define BOOST_RATIO_UINTMAX_C(a) a##ULL
  43. #endif
  44. #define BOOST_RATIO_INTMAX_T_MAX (0x7FFFFFFFFFFFFFFELL)
  45. #ifndef BOOST_NO_CXX11_STATIC_ASSERT
  46. #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) static_assert(CND,MSG)
  47. #elif defined(BOOST_RATIO_USES_STATIC_ASSERT)
  48. #include <boost/static_assert.hpp>
  49. #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) BOOST_STATIC_ASSERT(CND)
  50. #elif defined(BOOST_RATIO_USES_MPL_ASSERT)
  51. #include <boost/mpl/assert.hpp>
  52. #include <boost/mpl/bool.hpp>
  53. #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) \
  54. BOOST_MPL_ASSERT_MSG(boost::mpl::bool_< (CND) >::type::value, MSG, TYPES)
  55. #else
  56. //~ #elif defined(BOOST_RATIO_USES_ARRAY_ASSERT)
  57. #define BOOST_RATIO_CONCAT(A,B) A##B
  58. #define BOOST_RATIO_NAME(A,B) BOOST_RATIO_CONCAT(A,B)
  59. #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) static char BOOST_RATIO_NAME(__boost_ratio_test_,__LINE__)[(CND)?1:-1]
  60. //~ #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES)
  61. #endif
  62. #if !defined(BOOST_NO_CXX11_STATIC_ASSERT) || !defined(BOOST_RATIO_USES_MPL_ASSERT)
  63. #define BOOST_RATIO_OVERFLOW_IN_ADD "overflow in ratio add"
  64. #define BOOST_RATIO_OVERFLOW_IN_SUB "overflow in ratio sub"
  65. #define BOOST_RATIO_OVERFLOW_IN_MUL "overflow in ratio mul"
  66. #define BOOST_RATIO_OVERFLOW_IN_DIV "overflow in ratio div"
  67. #define BOOST_RATIO_NUMERATOR_IS_OUT_OF_RANGE "ratio numerator is out of range"
  68. #define BOOST_RATIO_DIVIDE_BY_0 "ratio divide by 0"
  69. #define BOOST_RATIO_DENOMINATOR_IS_OUT_OF_RANGE "ratio denominator is out of range"
  70. #endif
  71. //#define BOOST_RATIO_EXTENSIONS
  72. #endif // header