Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67296 - sandbox/chrono/boost/ratio
From: vicente.botet_at_[hidden]
Date: 2010-12-18 06:00:03


Author: viboes
Date: 2010-12-18 06:00:02 EST (Sat, 18 Dec 2010)
New Revision: 67296
URL: http://svn.boost.org/trac/boost/changeset/67296

Log:
Ratio: don't use static string by default

Text files modified:
   sandbox/chrono/boost/ratio/ratio.hpp | 4 ++--
   sandbox/chrono/boost/ratio/ratio_io.hpp | 36 ++++++++++++++++++++----------------
   2 files changed, 22 insertions(+), 18 deletions(-)

Modified: sandbox/chrono/boost/ratio/ratio.hpp
==============================================================================
--- sandbox/chrono/boost/ratio/ratio.hpp (original)
+++ sandbox/chrono/boost/ratio/ratio.hpp 2010-12-18 06:00:02 EST (Sat, 18 Dec 2010)
@@ -75,11 +75,11 @@
     BOOST_RATIO_STATIC_ASSERT(ABS_N >= 0, BOOST_RATIO_NUMERATOR_IS_OUT_OF_RANGE, ());
     BOOST_RATIO_STATIC_ASSERT(ABS_D > 0, BOOST_RATIO_DENOMINATOR_IS_OUT_OF_RANGE, ());
     BOOST_RATIO_STATIC_ASSERT(D != 0, BOOST_RATIO_DIVIDE_BY_0 , ());
- static const boost::intmax_t SIGN = boost::integer::static_signed_sign<N>::value
+ static const boost::intmax_t SIGN_N = boost::integer::static_signed_sign<N>::value
       * boost::integer::static_signed_sign<D>::value;
     static const boost::intmax_t GCD = boost::integer::static_signed_gcd<ABS_N, ABS_D>::value;
 public:
- static const boost::intmax_t num = SIGN * ABS_N / GCD;
+ static const boost::intmax_t num = SIGN_N * ABS_N / GCD;
     static const boost::intmax_t den = ABS_D / GCD;
 
 #ifdef BOOST_RATIO_EXTENSIONS

Modified: sandbox/chrono/boost/ratio/ratio_io.hpp
==============================================================================
--- sandbox/chrono/boost/ratio/ratio_io.hpp (original)
+++ sandbox/chrono/boost/ratio/ratio_io.hpp 2010-12-18 06:00:02 EST (Sat, 18 Dec 2010)
@@ -38,8 +38,10 @@
 #include <string>
 #include <sstream>
 
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
 #include <boost/ratio/ratio_static_string.hpp>
 #include <boost/static_string/static_string.hpp>
+#endif
 
 #if defined(BOOST_NO_UNICODE_LITERALS) || defined(BOOST_NO_CHAR16_T) || defined(BOOST_NO_CHAR32_T)
 //~ #define BOOST_RATIO_HAS_UNICODE_SUPPORT
@@ -65,6 +67,7 @@
                         << Ratio::den << CharT(']');
     return os.str();
 }
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
 namespace ratio_detail {
 template <class Ratio, class CharT>
 struct ratio_string_static
@@ -83,8 +86,9 @@
     }
 };
 }
+#endif
 // atto
-#if 1
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
 template <typename CharT>
 struct ratio_string<atto, CharT> :
     ratio_detail::ratio_string_static<atto,CharT>
@@ -128,7 +132,7 @@
 
 // femto
 
-#if 1
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
 template <typename CharT>
 struct ratio_string<femto, CharT> :
     ratio_detail::ratio_string_static<femto,CharT>
@@ -172,7 +176,7 @@
 
 // pico
 
-#if 1
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
 template <typename CharT>
 struct ratio_string<pico, CharT> :
     ratio_detail::ratio_string_static<pico,CharT>
@@ -216,7 +220,7 @@
 
 // nano
 
-#if 1
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
 template <typename CharT>
 struct ratio_string<nano, CharT> :
     ratio_detail::ratio_string_static<nano,CharT>
@@ -260,7 +264,7 @@
 
 // micro
 
-#if 1
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
 template <typename CharT>
 struct ratio_string<micro, CharT> :
     ratio_detail::ratio_string_static<micro,CharT>
@@ -304,7 +308,7 @@
 
 // milli
 
-#if 1
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
 template <typename CharT>
 struct ratio_string<milli, CharT> :
     ratio_detail::ratio_string_static<milli,CharT>
@@ -348,7 +352,7 @@
 
 // centi
 
-#if 1
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
 template <typename CharT>
 struct ratio_string<centi, CharT> :
     ratio_detail::ratio_string_static<centi,CharT>
@@ -391,7 +395,7 @@
 #endif
 
 // deci
-#if 1
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
 template <typename CharT>
 struct ratio_string<deci, CharT> :
     ratio_detail::ratio_string_static<deci,CharT>
@@ -436,7 +440,7 @@
 
 // deca
 
-#if 1
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
 template <typename CharT>
 struct ratio_string<deca, CharT> :
     ratio_detail::ratio_string_static<deca,CharT>
@@ -480,7 +484,7 @@
 
 // hecto
 
-#if 1
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
 template <typename CharT>
 struct ratio_string<hecto, CharT> :
     ratio_detail::ratio_string_static<hecto,CharT>
@@ -524,7 +528,7 @@
 
 // kilo
 
-#if 1
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
 template <typename CharT>
 struct ratio_string<kilo, CharT> :
     ratio_detail::ratio_string_static<kilo,CharT>
@@ -568,7 +572,7 @@
 
 // mega
 
-#if 1
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
 template <typename CharT>
 struct ratio_string<mega, CharT> :
     ratio_detail::ratio_string_static<mega,CharT>
@@ -612,7 +616,7 @@
 #endif
 
 // giga
-#if 1
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
 template <typename CharT>
 struct ratio_string<giga, CharT> :
     ratio_detail::ratio_string_static<giga,CharT>
@@ -656,7 +660,7 @@
 #endif
 
 // tera
-#if 1
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
 template <typename CharT>
 struct ratio_string<tera, CharT> :
     ratio_detail::ratio_string_static<tera,CharT>
@@ -699,7 +703,7 @@
 #endif
 
 // peta
-#if 1
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
 template <typename CharT>
 struct ratio_string<peta, CharT> :
     ratio_detail::ratio_string_static<peta,CharT>
@@ -742,7 +746,7 @@
 #endif
 
 // exa
-#if 1
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
 template <typename CharT>
 struct ratio_string<exa, CharT> :
     ratio_detail::ratio_string_static<exa,CharT>


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk