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