1 // config.hpp ---------------------------------------------------------------//
3 // Copyright 2012 Vicente J. Botet Escriba
5 // Distributed under the Boost Software License, Version 1.0.
6 // See http://www.boost.org/LICENSE_1_0.txt
9 #ifndef BOOST_RATIO_CONFIG_HPP
10 #define BOOST_RATIO_CONFIG_HPP
12 #include <boost/config.hpp>
13 #include <boost/cstdint.hpp>
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
20 # if ! defined BOOST_NO_CXX11_U32STRING
21 # define BOOST_NO_CXX11_U32STRING
26 #if !defined BOOST_RATIO_VERSION
27 #define BOOST_RATIO_VERSION 1
29 #if BOOST_RATIO_VERSION!=1 && BOOST_RATIO_VERSION!=2
30 #error "BOOST_RATIO_VERSION must be 1 or 2"
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
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
47 #define BOOST_RATIO_INTMAX_C(a) INTMAX_C(a)
48 #elif __cplusplus >= 201103L
49 #define BOOST_RATIO_INTMAX_C(a) a##LL
51 #define BOOST_RATIO_INTMAX_C(a) a##L
55 #define BOOST_RATIO_UINTMAX_C(a) UINTMAX_C(a)
56 #elif __cplusplus >= 201103L
57 #define BOOST_RATIO_UINTMAX_C(a) a##ULL
59 #define BOOST_RATIO_UINTMAX_C(a) a##UL
62 #define BOOST_RATIO_INTMAX_T_MAX (0x7FFFFFFFFFFFFFFELL)
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)
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)
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"
94 //#define BOOST_RATIO_EXTENSIONS