|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r77692 - in branches/release: boost/ratio boost/ratio/detail libs/ratio libs/ratio/example libs/ratio/test libs/ratio/test/ratio_arithmetic
From: vicente.botet_at_[hidden]
Date: 2012-04-01 15:10:29
Author: viboes
Date: 2012-04-01 15:10:27 EDT (Sun, 01 Apr 2012)
New Revision: 77692
URL: http://svn.boost.org/trac/boost/changeset/77692
Log:
Ratio: Fix #6498+merge from trunk
Properties modified:
branches/release/boost/ratio/ (props changed)
branches/release/libs/ratio/ (props changed)
Text files modified:
branches/release/boost/ratio/detail/overflow_helpers.hpp | 4
branches/release/boost/ratio/include.hpp | 2
branches/release/boost/ratio/ratio_io.hpp | 250 ++++++++++++++++++++++++++++++++++++++++
branches/release/libs/ratio/example/duration.hpp | 8
branches/release/libs/ratio/test/Jamfile.v2 | 1
branches/release/libs/ratio/test/ratio_arithmetic/ratio_add_pass.cpp | 6
branches/release/libs/ratio/test/ratio_arithmetic/ratio_subtract_pass.cpp | 6
7 files changed, 271 insertions(+), 6 deletions(-)
Modified: branches/release/boost/ratio/detail/overflow_helpers.hpp
==============================================================================
--- branches/release/boost/ratio/detail/overflow_helpers.hpp (original)
+++ branches/release/boost/ratio/detail/overflow_helpers.hpp 2012-04-01 15:10:27 EDT (Sun, 01 Apr 2012)
@@ -273,7 +273,7 @@
>
>::type type;
};
-
+
template <class R, boost::intmax_t D>
struct ratio_subtract<R, ratio<0,D> >
{
@@ -322,7 +322,7 @@
((R2::num / gcd_n1_n2 ==1) && (R1::den / gcd_d1_d2)==1)
> type;
};
-
+
template <class T>
struct is_ratio : public boost::false_type
{};
Modified: branches/release/boost/ratio/include.hpp
==============================================================================
--- branches/release/boost/ratio/include.hpp (original)
+++ branches/release/boost/ratio/include.hpp 2012-04-01 15:10:27 EDT (Sun, 01 Apr 2012)
@@ -10,6 +10,8 @@
#include <boost/ratio/ratio.hpp>
#include <boost/ratio/ratio_io.hpp>
+#ifdef BOOST_RATIO_EXTENSIONS
#include <boost/ratio/mpl/rational_constant.hpp>
+#endif
#endif // BOOST_RATIO_INCLUDE_HPP
Modified: branches/release/boost/ratio/ratio_io.hpp
==============================================================================
--- branches/release/boost/ratio/ratio_io.hpp (original)
+++ branches/release/boost/ratio/ratio_io.hpp 2012-04-01 15:10:27 EDT (Sun, 01 Apr 2012)
@@ -35,6 +35,7 @@
#include <boost/config.hpp>
#include <boost/ratio/ratio.hpp>
+#include <boost/type_traits/integral_constant.hpp>
#include <string>
#include <sstream>
@@ -51,11 +52,18 @@
namespace boost {
+template <class Ratio>
+struct ratio_string_is_localizable : false_type {};
+template <class Ratio>
+struct ratio_string_id : integral_constant<int,0> {};
+
template <class Ratio, class CharT>
struct ratio_string
{
static std::basic_string<CharT> short_name() {return long_name();}
static std::basic_string<CharT> long_name();
+ static std::basic_string<CharT> symbol() {return short_name();}
+ static std::basic_string<CharT> prefix() {return long_name();}
};
template <class Ratio, class CharT>
@@ -67,6 +75,7 @@
<< Ratio::den << CharT(']');
return os.str();
}
+
#ifdef BOOST_RATIO_HAS_STATIC_STRING
namespace ratio_detail {
template <class Ratio, class CharT>
@@ -84,10 +93,18 @@
typename ratio_static_string<Ratio, CharT>::long_name
>::value);
}
+ static std::basic_string<CharT> symbol() {return short_name();}
+ static std::basic_string<CharT> prefix() {return long_name();}
};
}
#endif
// atto
+template <>
+struct ratio_string_is_localizable<atto> : true_type {};
+
+template <>
+struct ratio_string_id<atto> : integral_constant<int,-18> {};
+
#ifdef BOOST_RATIO_HAS_STATIC_STRING
template <typename CharT>
struct ratio_string<atto, CharT> :
@@ -100,6 +117,8 @@
{
static std::string short_name() {return std::string(1, 'a');}
static std::string long_name() {return std::string("atto");}
+ static std::string symbol() {return short_name();}
+ static std::string prefix() {return long_name();}
};
#if BOOST_RATIO_HAS_UNICODE_SUPPORT
@@ -109,6 +128,8 @@
{
static std::u16string short_name() {return std::u16string(1, u'a');}
static std::u16string long_name() {return std::u16string(u"atto");}
+ static std::u16string symbol() {return short_name();}
+ static std::u16string prefix() {return long_name();}
};
template <>
@@ -116,6 +137,8 @@
{
static std::u32string short_name() {return std::u32string(1, U'a');}
static std::u32string long_name() {return std::u32string(U"atto");}
+ static std::u32string symbol() {return short_name();}
+ static std::u32string prefix() {return long_name();}
};
#endif
@@ -126,12 +149,20 @@
{
static std::wstring short_name() {return std::wstring(1, L'a');}
static std::wstring long_name() {return std::wstring(L"atto");}
+ static std::wstring symbol() {return short_name();}
+ static std::wstring prefix() {return long_name();}
};
#endif
#endif
// femto
+template <>
+struct ratio_string_is_localizable<femto> : true_type {};
+
+template <>
+struct ratio_string_id<femto> : integral_constant<int,-15> {};
+
#ifdef BOOST_RATIO_HAS_STATIC_STRING
template <typename CharT>
struct ratio_string<femto, CharT> :
@@ -139,11 +170,14 @@
{};
#else
+
template <>
struct ratio_string<femto, char>
{
static std::string short_name() {return std::string(1, 'f');}
static std::string long_name() {return std::string("femto");}
+ static std::string symbol() {return short_name();}
+ static std::string prefix() {return long_name();}
};
#if BOOST_RATIO_HAS_UNICODE_SUPPORT
@@ -153,6 +187,8 @@
{
static std::u16string short_name() {return std::u16string(1, u'f');}
static std::u16string long_name() {return std::u16string(u"femto");}
+ static std::u16string symbol() {return short_name();}
+ static std::u16string prefix() {return long_name();}
};
template <>
@@ -160,6 +196,8 @@
{
static std::u32string short_name() {return std::u32string(1, U'f');}
static std::u32string long_name() {return std::u32string(U"femto");}
+ static std::u32string symbol() {return short_name();}
+ static std::u32string prefix() {return long_name();}
};
#endif
@@ -170,12 +208,20 @@
{
static std::wstring short_name() {return std::wstring(1, L'f');}
static std::wstring long_name() {return std::wstring(L"femto");}
+ static std::wstring symbol() {return short_name();}
+ static std::wstring prefix() {return long_name();}
};
#endif
#endif
// pico
+template <>
+struct ratio_string_is_localizable<pico> : true_type {};
+
+template <>
+struct ratio_string_id<pico> : integral_constant<int,-12> {};
+
#ifdef BOOST_RATIO_HAS_STATIC_STRING
template <typename CharT>
struct ratio_string<pico, CharT> :
@@ -188,6 +234,8 @@
{
static std::string short_name() {return std::string(1, 'p');}
static std::string long_name() {return std::string("pico");}
+ static std::string symbol() {return short_name();}
+ static std::string prefix() {return long_name();}
};
#if BOOST_RATIO_HAS_UNICODE_SUPPORT
@@ -197,6 +245,8 @@
{
static std::u16string short_name() {return std::u16string(1, u'p');}
static std::u16string long_name() {return std::u16string(u"pico");}
+ static std::u16string symbol() {return short_name();}
+ static std::u16string prefix() {return long_name();}
};
template <>
@@ -204,6 +254,8 @@
{
static std::u32string short_name() {return std::u32string(1, U'p');}
static std::u32string long_name() {return std::u32string(U"pico");}
+ static std::u32string symbol() {return short_name();}
+ static std::u32string prefix() {return long_name();}
};
#endif
@@ -214,12 +266,20 @@
{
static std::wstring short_name() {return std::wstring(1, L'p');}
static std::wstring long_name() {return std::wstring(L"pico");}
+ static std::wstring symbol() {return short_name();}
+ static std::wstring prefix() {return long_name();}
};
#endif
#endif
// nano
+template <>
+struct ratio_string_is_localizable<nano> : true_type {};
+
+template <>
+struct ratio_string_id<nano> : integral_constant<int,-9> {};
+
#ifdef BOOST_RATIO_HAS_STATIC_STRING
template <typename CharT>
struct ratio_string<nano, CharT> :
@@ -232,6 +292,8 @@
{
static std::string short_name() {return std::string(1, 'n');}
static std::string long_name() {return std::string("nano");}
+ static std::string symbol() {return short_name();}
+ static std::string prefix() {return long_name();}
};
#if BOOST_RATIO_HAS_UNICODE_SUPPORT
@@ -241,6 +303,8 @@
{
static std::u16string short_name() {return std::u16string(1, u'n');}
static std::u16string long_name() {return std::u16string(u"nano");}
+ static std::u16string symbol() {return short_name();}
+ static std::u16string prefix() {return long_name();}
};
template <>
@@ -248,6 +312,8 @@
{
static std::u32string short_name() {return std::u32string(1, U'n');}
static std::u32string long_name() {return std::u32string(U"nano");}
+ static std::u32string symbol() {return short_name();}
+ static std::u32string prefix() {return long_name();}
};
#endif
@@ -258,12 +324,20 @@
{
static std::wstring short_name() {return std::wstring(1, L'n');}
static std::wstring long_name() {return std::wstring(L"nano");}
+ static std::wstring symbol() {return short_name();}
+ static std::wstring prefix() {return long_name();}
};
#endif
#endif
// micro
+template <>
+struct ratio_string_is_localizable<micro> : true_type {};
+
+template <>
+struct ratio_string_id<micro> : integral_constant<int,-6> {};
+
#ifdef BOOST_RATIO_HAS_STATIC_STRING
template <typename CharT>
struct ratio_string<micro, CharT> :
@@ -276,6 +350,8 @@
{
static std::string short_name() {return std::string("\xC2\xB5");}
static std::string long_name() {return std::string("micro");}
+ static std::string symbol() {return short_name();}
+ static std::string prefix() {return long_name();}
};
#if BOOST_RATIO_HAS_UNICODE_SUPPORT
@@ -285,6 +361,8 @@
{
static std::u16string short_name() {return std::u16string(1, u'\xB5');}
static std::u16string long_name() {return std::u16string(u"micro");}
+ static std::u16string symbol() {return short_name();}
+ static std::u16string prefix() {return long_name();}
};
template <>
@@ -292,6 +370,8 @@
{
static std::u32string short_name() {return std::u32string(1, U'\xB5');}
static std::u32string long_name() {return std::u32string(U"micro");}
+ static std::u32string symbol() {return short_name();}
+ static std::u32string prefix() {return long_name();}
};
#endif
@@ -302,12 +382,20 @@
{
static std::wstring short_name() {return std::wstring(1, L'\xB5');}
static std::wstring long_name() {return std::wstring(L"micro");}
+ static std::wstring symbol() {return short_name();}
+ static std::wstring prefix() {return long_name();}
};
#endif
#endif
// milli
+template <>
+struct ratio_string_is_localizable<milli> : true_type {};
+
+template <>
+struct ratio_string_id<milli> : integral_constant<int,-3> {};
+
#ifdef BOOST_RATIO_HAS_STATIC_STRING
template <typename CharT>
struct ratio_string<milli, CharT> :
@@ -320,6 +408,8 @@
{
static std::string short_name() {return std::string(1, 'm');}
static std::string long_name() {return std::string("milli");}
+ static std::string symbol() {return short_name();}
+ static std::string prefix() {return long_name();}
};
#if BOOST_RATIO_HAS_UNICODE_SUPPORT
@@ -329,6 +419,8 @@
{
static std::u16string short_name() {return std::u16string(1, u'm');}
static std::u16string long_name() {return std::u16string(u"milli");}
+ static std::u16string symbol() {return short_name();}
+ static std::u16string prefix() {return long_name();}
};
template <>
@@ -336,6 +428,8 @@
{
static std::u32string short_name() {return std::u32string(1, U'm');}
static std::u32string long_name() {return std::u32string(U"milli");}
+ static std::u32string symbol() {return short_name();}
+ static std::u32string prefix() {return long_name();}
};
#endif
@@ -346,12 +440,20 @@
{
static std::wstring short_name() {return std::wstring(1, L'm');}
static std::wstring long_name() {return std::wstring(L"milli");}
+ static std::wstring symbol() {return short_name();}
+ static std::wstring prefix() {return long_name();}
};
#endif
#endif
// centi
+template <>
+struct ratio_string_is_localizable<centi> : true_type {};
+
+template <>
+struct ratio_string_id<centi> : integral_constant<int,-2> {};
+
#ifdef BOOST_RATIO_HAS_STATIC_STRING
template <typename CharT>
struct ratio_string<centi, CharT> :
@@ -364,6 +466,8 @@
{
static std::string short_name() {return std::string(1, 'c');}
static std::string long_name() {return std::string("centi");}
+ static std::string symbol() {return short_name();}
+ static std::string prefix() {return long_name();}
};
#if BOOST_RATIO_HAS_UNICODE_SUPPORT
@@ -373,6 +477,8 @@
{
static std::u16string short_name() {return std::u16string(1, u'c');}
static std::u16string long_name() {return std::u16string(u"centi");}
+ static std::u16string symbol() {return short_name();}
+ static std::u16string prefix() {return long_name();}
};
template <>
@@ -380,6 +486,8 @@
{
static std::u32string short_name() {return std::u32string(1, U'c');}
static std::u32string long_name() {return std::u32string(U"centi");}
+ static std::u32string symbol() {return short_name();}
+ static std::u32string prefix() {return long_name();}
};
#endif
@@ -390,11 +498,20 @@
{
static std::wstring short_name() {return std::wstring(1, L'c');}
static std::wstring long_name() {return std::wstring(L"centi");}
+ static std::wstring symbol() {return short_name();}
+ static std::wstring prefix() {return long_name();}
};
#endif
#endif
// deci
+
+template <>
+struct ratio_string_is_localizable<deci> : true_type {};
+
+template <>
+struct ratio_string_id<deci> : integral_constant<int,-1> {};
+
#ifdef BOOST_RATIO_HAS_STATIC_STRING
template <typename CharT>
struct ratio_string<deci, CharT> :
@@ -408,6 +525,8 @@
{
static std::string short_name() {return std::string(1, 'd');}
static std::string long_name() {return std::string("deci");}
+ static std::string symbol() {return short_name();}
+ static std::string prefix() {return long_name();}
};
#if BOOST_RATIO_HAS_UNICODE_SUPPORT
@@ -417,6 +536,8 @@
{
static std::u16string short_name() {return std::u16string(1, u'd');}
static std::u16string long_name() {return std::u16string(u"deci");}
+ static std::u16string symbol() {return short_name();}
+ static std::u16string prefix() {return long_name();}
};
template <>
@@ -424,6 +545,8 @@
{
static std::u32string short_name() {return std::u32string(1, U'd');}
static std::u32string long_name() {return std::u32string(U"deci");}
+ static std::u32string symbol() {return short_name();}
+ static std::u32string prefix() {return long_name();}
};
#endif
@@ -434,12 +557,27 @@
{
static std::wstring short_name() {return std::wstring(1, L'd');}
static std::wstring long_name() {return std::wstring(L"deci");}
+ static std::wstring symbol() {return short_name();}
+ static std::wstring prefix() {return long_name();}
};
#endif
#endif
+// unit
+
+template <>
+struct ratio_string_is_localizable<ratio<1> > : true_type {};
+
+template <>
+struct ratio_string_id<ratio<1> > : integral_constant<int,0> {};
// deca
+template <>
+struct ratio_string_is_localizable<deca> : true_type {};
+
+template <>
+struct ratio_string_id<deca> : integral_constant<int,1> {};
+
#ifdef BOOST_RATIO_HAS_STATIC_STRING
template <typename CharT>
struct ratio_string<deca, CharT> :
@@ -452,6 +590,8 @@
{
static std::string short_name() {return std::string("da");}
static std::string long_name() {return std::string("deca");}
+ static std::string symbol() {return short_name();}
+ static std::string prefix() {return long_name();}
};
#if BOOST_RATIO_HAS_UNICODE_SUPPORT
@@ -461,6 +601,8 @@
{
static std::u16string short_name() {return std::u16string(u"da");}
static std::u16string long_name() {return std::u16string(u"deca");}
+ static std::u16string symbol() {return short_name();}
+ static std::u16string prefix() {return long_name();}
};
template <>
@@ -468,6 +610,8 @@
{
static std::u32string short_name() {return std::u32string(U"da");}
static std::u32string long_name() {return std::u32string(U"deca");}
+ static std::u32string symbol() {return short_name();}
+ static std::u32string prefix() {return long_name();}
};
#endif
@@ -478,12 +622,21 @@
{
static std::wstring short_name() {return std::wstring(L"da");}
static std::wstring long_name() {return std::wstring(L"deca");}
+ static std::wstring symbol() {return short_name();}
+ static std::wstring prefix() {return long_name();}
};
#endif
#endif
// hecto
+template <>
+struct ratio_string_is_localizable<hecto> : true_type {};
+
+template <>
+struct ratio_string_id<hecto> : integral_constant<int,2> {};
+
+
#ifdef BOOST_RATIO_HAS_STATIC_STRING
template <typename CharT>
struct ratio_string<hecto, CharT> :
@@ -496,6 +649,8 @@
{
static std::string short_name() {return std::string(1, 'h');}
static std::string long_name() {return std::string("hecto");}
+ static std::string symbol() {return short_name();}
+ static std::string prefix() {return long_name();}
};
#if BOOST_RATIO_HAS_UNICODE_SUPPORT
@@ -505,6 +660,8 @@
{
static std::u16string short_name() {return std::u16string(1, u'h');}
static std::u16string long_name() {return std::u16string(u"hecto");}
+ static std::u16string symbol() {return short_name();}
+ static std::u16string prefix() {return long_name();}
};
template <>
@@ -512,6 +669,8 @@
{
static std::u32string short_name() {return std::u32string(1, U'h');}
static std::u32string long_name() {return std::u32string(U"hecto");}
+ static std::u32string symbol() {return short_name();}
+ static std::u32string prefix() {return long_name();}
};
#endif
@@ -522,12 +681,20 @@
{
static std::wstring short_name() {return std::wstring(1, L'h');}
static std::wstring long_name() {return std::wstring(L"hecto");}
+ static std::wstring symbol() {return short_name();}
+ static std::wstring prefix() {return long_name();}
};
#endif
#endif
// kilo
+template <>
+struct ratio_string_is_localizable<kilo> : true_type {};
+
+template <>
+struct ratio_string_id<kilo> : integral_constant<int,3> {};
+
#ifdef BOOST_RATIO_HAS_STATIC_STRING
template <typename CharT>
struct ratio_string<kilo, CharT> :
@@ -540,6 +707,8 @@
{
static std::string short_name() {return std::string(1, 'k');}
static std::string long_name() {return std::string("kilo");}
+ static std::string symbol() {return short_name();}
+ static std::string prefix() {return long_name();}
};
#if BOOST_RATIO_HAS_UNICODE_SUPPORT
@@ -549,6 +718,8 @@
{
static std::u16string short_name() {return std::u16string(1, u'k');}
static std::u16string long_name() {return std::u16string(u"kilo");}
+ static std::u16string symbol() {return short_name();}
+ static std::u16string prefix() {return long_name();}
};
template <>
@@ -556,6 +727,8 @@
{
static std::u32string short_name() {return std::u32string(1, U'k');}
static std::u32string long_name() {return std::u32string(U"kilo");}
+ static std::u32string symbol() {return short_name();}
+ static std::u32string prefix() {return long_name();}
};
#endif
@@ -566,12 +739,20 @@
{
static std::wstring short_name() {return std::wstring(1, L'k');}
static std::wstring long_name() {return std::wstring(L"kilo");}
+ static std::wstring symbol() {return short_name();}
+ static std::wstring prefix() {return long_name();}
};
#endif
#endif
// mega
+template <>
+struct ratio_string_is_localizable<mega> : true_type {};
+
+template <>
+struct ratio_string_id<mega> : integral_constant<int,6> {};
+
#ifdef BOOST_RATIO_HAS_STATIC_STRING
template <typename CharT>
struct ratio_string<mega, CharT> :
@@ -585,6 +766,8 @@
{
static std::string short_name() {return std::string(1, 'M');}
static std::string long_name() {return std::string("mega");}
+ static std::string symbol() {return short_name();}
+ static std::string prefix() {return long_name();}
};
#if BOOST_RATIO_HAS_UNICODE_SUPPORT
@@ -594,6 +777,8 @@
{
static std::u16string short_name() {return std::u16string(1, u'M');}
static std::u16string long_name() {return std::u16string(u"mega");}
+ static std::u16string symbol() {return short_name();}
+ static std::u16string prefix() {return long_name();}
};
template <>
@@ -601,6 +786,8 @@
{
static std::u32string short_name() {return std::u32string(1, U'M');}
static std::u32string long_name() {return std::u32string(U"mega");}
+ static std::u32string symbol() {return short_name();}
+ static std::u32string prefix() {return long_name();}
};
#endif
@@ -611,11 +798,20 @@
{
static std::wstring short_name() {return std::wstring(1, L'M');}
static std::wstring long_name() {return std::wstring(L"mega");}
+ static std::wstring symbol() {return short_name();}
+ static std::wstring prefix() {return long_name();}
};
#endif
#endif
// giga
+
+template <>
+struct ratio_string_is_localizable<giga> : true_type {};
+
+template <>
+struct ratio_string_id<giga> : integral_constant<int,9> {};
+
#ifdef BOOST_RATIO_HAS_STATIC_STRING
template <typename CharT>
struct ratio_string<giga, CharT> :
@@ -629,6 +825,8 @@
{
static std::string short_name() {return std::string(1, 'G');}
static std::string long_name() {return std::string("giga");}
+ static std::string symbol() {return short_name();}
+ static std::string prefix() {return long_name();}
};
#if BOOST_RATIO_HAS_UNICODE_SUPPORT
@@ -638,6 +836,8 @@
{
static std::u16string short_name() {return std::u16string(1, u'G');}
static std::u16string long_name() {return std::u16string(u"giga");}
+ static std::u16string symbol() {return short_name();}
+ static std::u16string prefix() {return long_name();}
};
template <>
@@ -645,6 +845,8 @@
{
static std::u32string short_name() {return std::u32string(1, U'G');}
static std::u32string long_name() {return std::u32string(U"giga");}
+ static std::u32string symbol() {return short_name();}
+ static std::u32string prefix() {return long_name();}
};
#endif
@@ -655,11 +857,20 @@
{
static std::wstring short_name() {return std::wstring(1, L'G');}
static std::wstring long_name() {return std::wstring(L"giga");}
+ static std::wstring symbol() {return short_name();}
+ static std::wstring prefix() {return long_name();}
};
#endif
#endif
// tera
+
+template <>
+struct ratio_string_is_localizable<tera> : true_type {};
+
+template <>
+struct ratio_string_id<tera> : integral_constant<int,12> {};
+
#ifdef BOOST_RATIO_HAS_STATIC_STRING
template <typename CharT>
struct ratio_string<tera, CharT> :
@@ -672,6 +883,8 @@
{
static std::string short_name() {return std::string(1, 'T');}
static std::string long_name() {return std::string("tera");}
+ static std::string symbol() {return short_name();}
+ static std::string prefix() {return long_name();}
};
#if BOOST_RATIO_HAS_UNICODE_SUPPORT
@@ -681,6 +894,8 @@
{
static std::u16string short_name() {return std::u16string(1, u'T');}
static std::u16string long_name() {return std::u16string(u"tera");}
+ static std::u16string symbol() {return short_name();}
+ static std::u16string prefix() {return long_name();}
};
template <>
@@ -688,6 +903,8 @@
{
static std::u32string short_name() {return std::u32string(1, U'T');}
static std::u32string long_name() {return std::u32string(U"tera");}
+ static std::u32string symbol() {return short_name();}
+ static std::u32string prefix() {return long_name();}
};
#endif
@@ -698,11 +915,21 @@
{
static std::wstring short_name() {return std::wstring(1, L'T');}
static std::wstring long_name() {return std::wstring(L"tera");}
+ static std::wstring symbol() {return short_name();}
+ static std::wstring prefix() {return long_name();}
};
#endif
#endif
// peta
+
+template <>
+struct ratio_string_is_localizable<peta> : true_type {};
+
+template <>
+struct ratio_string_id<peta> : integral_constant<int,15> {};
+
+
#ifdef BOOST_RATIO_HAS_STATIC_STRING
template <typename CharT>
struct ratio_string<peta, CharT> :
@@ -715,6 +942,8 @@
{
static std::string short_name() {return std::string(1, 'P');}
static std::string long_name() {return std::string("peta");}
+ static std::string symbol() {return short_name();}
+ static std::string prefix() {return long_name();}
};
#if BOOST_RATIO_HAS_UNICODE_SUPPORT
@@ -724,6 +953,8 @@
{
static std::u16string short_name() {return std::u16string(1, u'P');}
static std::u16string long_name() {return std::u16string(u"peta");}
+ static std::u16string symbol() {return short_name();}
+ static std::u16string prefix() {return long_name();}
};
template <>
@@ -731,6 +962,8 @@
{
static std::u32string short_name() {return std::u32string(1, U'P');}
static std::u32string long_name() {return std::u32string(U"peta");}
+ static std::u32string symbol() {return short_name();}
+ static std::u32string prefix() {return long_name();}
};
#endif
@@ -741,11 +974,20 @@
{
static std::wstring short_name() {return std::wstring(1, L'P');}
static std::wstring long_name() {return std::wstring(L"peta");}
+ static std::wstring symbol() {return short_name();}
+ static std::wstring prefix() {return long_name();}
};
#endif
#endif
// exa
+
+template <>
+struct ratio_string_is_localizable<exa> : true_type {};
+
+template <>
+struct ratio_string_id<exa> : integral_constant<int,18> {};
+
#ifdef BOOST_RATIO_HAS_STATIC_STRING
template <typename CharT>
struct ratio_string<exa, CharT> :
@@ -758,6 +1000,8 @@
{
static std::string short_name() {return std::string(1, 'E');}
static std::string long_name() {return std::string("exa");}
+ static std::string symbol() {return short_name();}
+ static std::string prefix() {return long_name();}
};
#if BOOST_RATIO_HAS_UNICODE_SUPPORT
@@ -767,6 +1011,8 @@
{
static std::u16string short_name() {return std::u16string(1, u'E');}
static std::u16string long_name() {return std::u16string(u"exa");}
+ static std::u16string symbol() {return short_name();}
+ static std::u16string prefix() {return long_name();}
};
template <>
@@ -774,6 +1020,8 @@
{
static std::u32string short_name() {return std::u32string(1, U'E');}
static std::u32string long_name() {return std::u32string(U"exa");}
+ static std::u32string symbol() {return short_name();}
+ static std::u32string prefix() {return long_name();}
};
#endif
@@ -784,6 +1032,8 @@
{
static std::wstring short_name() {return std::wstring(1, L'E');}
static std::wstring long_name() {return std::wstring(L"exa");}
+ static std::wstring symbol() {return short_name();}
+ static std::wstring prefix() {return long_name();}
};
#endif
#endif
Modified: branches/release/libs/ratio/example/duration.hpp
==============================================================================
--- branches/release/libs/ratio/example/duration.hpp (original)
+++ branches/release/libs/ratio/example/duration.hpp 2012-04-01 15:10:27 EDT (Sun, 01 Apr 2012)
@@ -464,7 +464,7 @@
explicit duration(const Rep2& r
#if (defined(BOOST_MSVC) && (BOOST_MSVC == 1500)) || defined(__IBMCPP__)
#else
- , typename boost::enable_if <
+ , typename boost::enable_if <
boost::mpl::and_ <
boost::is_convertible<Rep2, rep>,
boost::mpl::or_ <
@@ -477,7 +477,7 @@
>
>::type* = 0
#endif
- )
+ )
: rep_(r) { }
~duration() {} //= default;
duration(const duration& rhs) : rep_(rhs.rep_) {} // = default;
@@ -492,7 +492,7 @@
duration(const duration<Rep2, Period2>& d
#if (defined(BOOST_MSVC) && (BOOST_MSVC == 1500)) || defined(__IBMCPP__)
#else
- , typename boost::enable_if <
+ , typename boost::enable_if <
boost::mpl::or_ <
treat_as_floating_point<rep>,
boost::mpl::and_ <
@@ -502,7 +502,7 @@
>
>::type* = 0
#endif
- )
+ )
//~ #ifdef __GNUC__
// GCC 4.2.4 refused to accept a definition at this point,
// yet both VC++ 9.0 SP1 and Intel ia32 11.0 accepted the definition
Modified: branches/release/libs/ratio/test/Jamfile.v2
==============================================================================
--- branches/release/libs/ratio/test/Jamfile.v2 (original)
+++ branches/release/libs/ratio/test/Jamfile.v2 2012-04-01 15:10:27 EDT (Sun, 01 Apr 2012)
@@ -117,3 +117,4 @@
[ compile ratio_extensions/mpl_rational_constant_pass.cpp ]
;
+
Modified: branches/release/libs/ratio/test/ratio_arithmetic/ratio_add_pass.cpp
==============================================================================
--- branches/release/libs/ratio/test/ratio_arithmetic/ratio_add_pass.cpp (original)
+++ branches/release/libs/ratio/test/ratio_arithmetic/ratio_add_pass.cpp 2012-04-01 15:10:27 EDT (Sun, 01 Apr 2012)
@@ -20,6 +20,12 @@
void test()
{
+ {
+ typedef boost::ratio<0> R1;
+ typedef boost::ratio<0> R2;
+ typedef boost::ratio_add<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 0 && R::den == 1, NOTHING, ());
+ }
{
typedef boost::ratio<1, 1> R1;
typedef boost::ratio<1, 1> R2;
Modified: branches/release/libs/ratio/test/ratio_arithmetic/ratio_subtract_pass.cpp
==============================================================================
--- branches/release/libs/ratio/test/ratio_arithmetic/ratio_subtract_pass.cpp (original)
+++ branches/release/libs/ratio/test/ratio_arithmetic/ratio_subtract_pass.cpp 2012-04-01 15:10:27 EDT (Sun, 01 Apr 2012)
@@ -21,6 +21,12 @@
void test()
{
+ {
+ typedef boost::ratio<0> R1;
+ typedef boost::ratio<0> R2;
+ typedef boost::ratio_subtract<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 0 && R::den == 1, NOTHING, ());
+ }
{
typedef boost::ratio<1, 1> R1;
typedef boost::ratio<1, 1> R2;
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