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)
49 #define BOOST_RATIO_INTMAX_C(a) a##LL
53 #define BOOST_RATIO_UINTMAX_C(a) UINTMAX_C(a)
55 #define BOOST_RATIO_UINTMAX_C(a) a##ULL
58 #define BOOST_RATIO_INTMAX_T_MAX (0x7FFFFFFFFFFFFFFELL)
61 #ifndef BOOST_NO_CXX11_STATIC_ASSERT
62 #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) static_assert(CND,MSG)
63 #elif defined(BOOST_RATIO_USES_STATIC_ASSERT)
64 #include <boost/static_assert.hpp>
65 #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) BOOST_STATIC_ASSERT(CND)
66 #elif defined(BOOST_RATIO_USES_MPL_ASSERT)
67 #include <boost/mpl/assert.hpp>
68 #include <boost/mpl/bool.hpp>
69 #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) \
70 BOOST_MPL_ASSERT_MSG(boost::mpl::bool_< (CND) >::type::value, MSG, TYPES)
72 //~ #elif defined(BOOST_RATIO_USES_ARRAY_ASSERT)
73 #define BOOST_RATIO_CONCAT(A,B) A##B
74 #define BOOST_RATIO_NAME(A,B) BOOST_RATIO_CONCAT(A,B)
75 #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) static char BOOST_RATIO_NAME(__boost_ratio_test_,__LINE__)[(CND)?1:-1]
76 //~ #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES)
79 #if !defined(BOOST_NO_CXX11_STATIC_ASSERT) || !defined(BOOST_RATIO_USES_MPL_ASSERT)
80 #define BOOST_RATIO_OVERFLOW_IN_ADD "overflow in ratio add"
81 #define BOOST_RATIO_OVERFLOW_IN_SUB "overflow in ratio sub"
82 #define BOOST_RATIO_OVERFLOW_IN_MUL "overflow in ratio mul"
83 #define BOOST_RATIO_OVERFLOW_IN_DIV "overflow in ratio div"
84 #define BOOST_RATIO_NUMERATOR_IS_OUT_OF_RANGE "ratio numerator is out of range"
85 #define BOOST_RATIO_DIVIDE_BY_0 "ratio divide by 0"
86 #define BOOST_RATIO_DENOMINATOR_IS_OUT_OF_RANGE "ratio denominator is out of range"
90 //#define BOOST_RATIO_EXTENSIONS