mirror of
https://github.com/boostorg/ratio.git
synced 2025-05-09 23:24:01 +00:00
Ratio: version 2: Added prefix/symbol functions ratio_io.
[SVN r80317]
This commit is contained in:
parent
e44b1e6e50
commit
59e0b9bbca
401
doc/ratio.qbk
401
doc/ratio.qbk
@ -9,13 +9,13 @@
|
||||
|
||||
[library Boost.Ratio
|
||||
[quickbook 1.5]
|
||||
[version 1.0.1]
|
||||
[version 2.0.0]
|
||||
[authors [Hinnant, Howard]]
|
||||
[authors [Dawes, Beman]]
|
||||
[authors [Botet Escriba, Vicente J.]]
|
||||
[copyright 2008 Howard Hinnant]
|
||||
[copyright 2006, 2008 Beman Dawes]
|
||||
[copyright 2009-2011 Vicente J. Botet Escriba]
|
||||
[copyright 2009-2012 Vicente J. Botet Escriba]
|
||||
[category math]
|
||||
[id ratio]
|
||||
[dirname ratio]
|
||||
@ -42,12 +42,14 @@
|
||||
|
||||
[template ratio_conf[link_text] [link ratio.reference.std.ratio_hpp.conf [link_text]]]
|
||||
|
||||
[def __BOOST_RATIO_USES_STATIC_ASSERT [link ratio.reference.std.ratio_hpp.conf `BOOST_RATIO_USES_STATIC_ASSERT`]]
|
||||
[def __BOOST_RATIO_USES_MPL_ASSERT [link ratio.reference.std.ratio_hpp.conf `BOOST_RATIO_USES_MPL_ASSERT`]]
|
||||
[def __BOOST_RATIO_USES_ARRAY_ASSERT [link ratio.reference.std.ratio_hpp.conf `BOOST_RATIO_USES_ARRAY_ASSERT`]]
|
||||
|
||||
[def __BOOST_RATIO_EXTENSIONS [link ratio.reference.std.ratio_hpp.extensions `BOOST_RATIO_EXTENSIONS`]]
|
||||
[def __BOOST_RATIO_USES_STATIC_ASSERT [link ratio.reference.config_hpp.assert `BOOST_RATIO_USES_STATIC_ASSERT`]]
|
||||
[def __BOOST_RATIO_USES_MPL_ASSERT [link ratio.reference.config_hpp.assert `BOOST_RATIO_USES_MPL_ASSERT`]]
|
||||
[def __BOOST_RATIO_USES_ARRAY_ASSERT [link ratio.reference.config_hpp.assert `BOOST_RATIO_USES_ARRAY_ASSERT`]]
|
||||
|
||||
[def __BOOST_RATIO_EXTENSIONS [link ratio.reference.config_hpp.ext `BOOST_RATIO_EXTENSIONS`]]
|
||||
[def __BOOST_RATIO_PROVIDES_DEPRECATED_FEATURES_SINCE_V2_0_0 [link ratio.reference.config_hpp.deprecated `BOOST_RATIO_PROVIDES_DEPRECATED_FEATURES_SINCE_V2_0_0`]]
|
||||
[def __BOOST_RATIO_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V2_0_0 [link ratio.reference.config_hpp.deprecated `BOOST_RATIO_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V2_0_0 `]]
|
||||
[def __BOOST_RATIO_VERSION [link ratio.reference.config_hpp.version `BOOST_RATIO_VERSION `]]
|
||||
|
||||
|
||||
[template ratio_arithmetic[link_text] [link ratio.reference.std.ratio_hpp.ratio_arithmetic [link_text]]]
|
||||
@ -313,7 +315,7 @@ This facility also includes convenience typedefs for the SI prefixes __atto thro
|
||||
|
||||
[heading Ratio I/O]
|
||||
|
||||
For each `ratio<N, D>` there exists a `ratio_string<ratio<N, D>, CharT>` for which you can query two strings: `short_name` and `long_name`. For those `ratio`'s that correspond to an [@http://en.wikipedia.org/wiki/SI_prefix#List_of_SI_prefixes SI prefix] long_name corresponds to the internationally recognized prefix, stored as a `basic_string<CharT>`. For example `ratio_string<mega, char>::long_name()` returns `string("mega")`. For those `ratio`s that correspond to an [@http://en.wikipedia.org/wiki/SI_prefix#List_of_SI_prefixes SI prefix] `short_name` corresponds to the internationally recognized symbol, stored as a `basic_string<CharT>`. For example, `ratio_string<mega, char>::short_name()` returns `string("M")`. For all other `ratio`s, both `long_name()` and `short_name()` return a `basic_string` containing "[`ratio::num/ratio::den`]".
|
||||
For each `ratio<N, D>` there exists a `ratio_string<ratio<N, D>, CharT>` for which you can query two strings: `symbol` and `prefix`. For those `ratio`'s that correspond to an [@http://en.wikipedia.org/wiki/SI_prefix#List_of_SI_prefixes SI prefix] prefix corresponds to the internationally recognized prefix, stored as a `basic_string<CharT>`. For example `ratio_string<mega, char>::prefix()` returns `string("mega")`. For those `ratio`s that correspond to an [@http://en.wikipedia.org/wiki/SI_prefix#List_of_SI_prefixes SI prefix] `symbol` corresponds to the internationally recognized symbol, stored as a `basic_string<CharT>`. For example, `ratio_string<mega, char>::symbol()` returns `string("M")`. For all other `ratio`s, both `prefix()` and `symbol()` return a `basic_string` containing "[`ratio::num/ratio::den`]".
|
||||
|
||||
`ratio_string<ratio<N, D>, CharT>` is only defined for four character types:
|
||||
|
||||
@ -324,7 +326,7 @@ For each `ratio<N, D>` there exists a `ratio_string<ratio<N, D>, CharT>` for whi
|
||||
|
||||
When the character is char, UTF-8 will be used to encode the names. When the character is `char16_t`, UTF-16 will be used to encode the names. When the character is `char32_t`, UTF-32 will be used to encode the names. When the character is `wchar_t`, the encoding will be UTF-16 if `wchar_t` is 16 bits, and otherwise UTF-32.
|
||||
|
||||
The `short_name` (Greek mu or [mu]) for micro is defined by [@http://www.unicode.org/charts/PDF/U0080.pdf Unicode] to be U+00B5.
|
||||
The `symbol` (Greek mu or [mu]) for micro is defined by [@http://www.unicode.org/charts/PDF/U0080.pdf Unicode] to be U+00B5.
|
||||
|
||||
[*Examples:]
|
||||
|
||||
@ -336,30 +338,30 @@ The `short_name` (Greek mu or [mu]) for micro is defined by [@http://www.unicode
|
||||
using namespace std;
|
||||
using namespace boost;
|
||||
|
||||
cout << "ratio_string<deca, char>::long_name() = "
|
||||
<< ratio_string<deca, char>::long_name() << '\n';
|
||||
cout << "ratio_string<deca, char>::short_name() = "
|
||||
<< ratio_string<deca, char>::short_name() << '\n';
|
||||
cout << "ratio_string<deca, char>::prefix() = "
|
||||
<< ratio_string<deca, char>::prefix() << '\n';
|
||||
cout << "ratio_string<deca, char>::symbol() = "
|
||||
<< ratio_string<deca, char>::symbol() << '\n';
|
||||
|
||||
cout << "ratio_string<giga, char>::long_name() = "
|
||||
<< ratio_string<giga, char>::long_name() << '\n';
|
||||
cout << "ratio_string<giga, char>::short_name() = "
|
||||
<< ratio_string<giga, char>::short_name() << '\n';
|
||||
cout << "ratio_string<giga, char>::prefix() = "
|
||||
<< ratio_string<giga, char>::prefix() << '\n';
|
||||
cout << "ratio_string<giga, char>::symbol() = "
|
||||
<< ratio_string<giga, char>::symbol() << '\n';
|
||||
|
||||
cout << "ratio_string<ratio<4, 6>, char>::long_name() = "
|
||||
<< ratio_string<ratio<4, 6>, char>::long_name() << '\n';
|
||||
cout << "ratio_string<ratio<4, 6>, char>::short_name() = "
|
||||
<< ratio_string<ratio<4, 6>, char>::short_name() << '\n';
|
||||
cout << "ratio_string<ratio<4, 6>, char>::prefix() = "
|
||||
<< ratio_string<ratio<4, 6>, char>::prefix() << '\n';
|
||||
cout << "ratio_string<ratio<4, 6>, char>::symbol() = "
|
||||
<< ratio_string<ratio<4, 6>, char>::symbol() << '\n';
|
||||
}
|
||||
|
||||
The output will be
|
||||
|
||||
ratio_string<deca, char>::long_name() = deca
|
||||
ratio_string<deca, char>::short_name() = da
|
||||
ratio_string<giga, char>::long_name() = giga
|
||||
ratio_string<giga, char>::short_name() = G
|
||||
ratio_string<ratio<4, 6>, char>::long_name() = [2/3]
|
||||
ratio_string<ratio<4, 6>, char>::short_name() = [2/3]
|
||||
ratio_string<deca, char>::prefix() = deca
|
||||
ratio_string<deca, char>::symbol() = da
|
||||
ratio_string<giga, char>::prefix() = giga
|
||||
ratio_string<giga, char>::symbol() = G
|
||||
ratio_string<ratio<4, 6>, char>::prefix() = [2/3]
|
||||
ratio_string<ratio<4, 6>, char>::symbol() = [2/3]
|
||||
|
||||
|
||||
[heading Ratio MPL Numeric Metafunctions]
|
||||
@ -641,6 +643,68 @@ Finally, we can exercise what we've created, even using custom time durations (`
|
||||
[section:reference Reference ]
|
||||
[/=================]
|
||||
|
||||
[/=================================================]
|
||||
[section:config_hpp Header `<boost/ratio/config.hpp>`]
|
||||
[/=================================================]
|
||||
|
||||
|
||||
// Configuration macros
|
||||
#define __BOOST_RATIO_VERSION
|
||||
#define __BOOST_RATIO_EXTENSIONS
|
||||
#define __BOOST_RATIO_PROVIDES_DEPRECATED_FEATURES_SINCE_V2_0_0
|
||||
#define __BOOST_RATIO_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V2_0_0
|
||||
#define __BOOST_RATIO_USES_STATIC_ASSERT
|
||||
#define __BOOST_RATIO_USES_MPL_ASSERT
|
||||
#define __BOOST_RATIO_USES_ARRAY_ASSERT
|
||||
|
||||
|
||||
[section:ext Extensions]
|
||||
|
||||
When __BOOST_RATIO_EXTENSIONS is defined, __Boost_Ratio provides in addition some extension to the C++ standard, see below.
|
||||
|
||||
[endsect]
|
||||
[section:deprecated Deprecated]
|
||||
|
||||
When __BOOST_RATIO_PROVIDES_DEPRECATED_FEATURES_SINCE_V2_0_0 is defined the deprecated features stated as DEPRECATED V2 are provided.
|
||||
|
||||
When __BOOST_RATIO_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V2_0_0 is defined the deprecated features stated as DEPRECATED V2 are NOT provided.
|
||||
|
||||
[endsect]
|
||||
[section:version Version]
|
||||
|
||||
__BOOST_RATIO_VERSION stands for the Boost.Ratio version which can be 1 or 2. The default up to 1.55 is version 1. Since 1.56 it will be 2.
|
||||
|
||||
When __BOOST_RATIO_VERSION is 1 __BOOST_RATIO_PROVIDES_DEPRECATED_FEATURES_SINCE_V2_0_0 is defined by default.
|
||||
|
||||
When __BOOST_RATIO_VERSION is 2 __BOOST_RATIO_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V2_0_0 is defined by default.
|
||||
|
||||
[endsect]
|
||||
[section:assert Static Assert]
|
||||
|
||||
When BOOST_NO_STATIC_ASSERT is defined, the user can select the way static assertions are reported. Define
|
||||
|
||||
* __BOOST_RATIO_USES_STATIC_ASSERT to use Boost.StaticAssert.
|
||||
* __BOOST_RATIO_USES_MPL_ASSERT to use [*Boost.MPL] static assertions.
|
||||
* __BOOST_RATIO_USES_ARRAY_ASSERT to use __Boost_Ratio internal static assertions.
|
||||
|
||||
The default behavior is as if __BOOST_RATIO_USES_ARRAY_ASSERT was defined.
|
||||
|
||||
When __BOOST_RATIO_USES_MPL_ASSERT is not defined the following symbols are defined as shown:
|
||||
|
||||
#define BOOST_RATIO_OVERFLOW_IN_ADD "overflow in ratio add"
|
||||
#define BOOST_RATIO_OVERFLOW_IN_SUB "overflow in ratio sub"
|
||||
#define BOOST_RATIO_OVERFLOW_IN_MUL "overflow in ratio mul"
|
||||
#define BOOST_RATIO_OVERFLOW_IN_DIV "overflow in ratio div"
|
||||
#define BOOST_RATIO_NUMERATOR_IS_OUT_OF_RANGE "ratio numerator is out of range"
|
||||
#define BOOST_RATIO_DIVIDE_BY_0 "ratio divide by 0"
|
||||
#define BOOST_RATIO_DENOMINATOR_IS_OUT_OF_RANGE "ratio denominator is out of range"
|
||||
|
||||
Depending upon the static assertion system used, a hint as to the failing assertion will appear in some form in the compiler diagnostic output.
|
||||
|
||||
|
||||
[endsect]
|
||||
[endsect]
|
||||
|
||||
[/=================================================]
|
||||
[section:std C++0x Recommendation]
|
||||
[/=================================================]
|
||||
@ -707,46 +771,13 @@ This header provides forward declarations for the `<boost/ratio/ratio.hpp>` file
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
[/=================================================]
|
||||
[section:ratio_hpp Header `<boost/ratio/ratio.hpp>`]
|
||||
[/=================================================]
|
||||
|
||||
__ratio is a facility which is useful in specifying compile-time rational constants. Compile-time rational arithmetic is supported with protection against overflow and divide by zero. Such a facility is very handy to efficiently represent 1/3 of a nanosecond, or to specify an inch in terms of meters (for example 254/10000 meters - which __ratio will reduce to 127/5000 meters).
|
||||
|
||||
// Configuration macros
|
||||
#define __BOOST_RATIO_USES_STATIC_ASSERT
|
||||
#define __BOOST_RATIO_USES_MPL_ASSERT
|
||||
#define __BOOST_RATIO_USES_ARRAY_ASSERT
|
||||
#define __BOOST_RATIO_EXTENSIONS
|
||||
|
||||
|
||||
[section:conf Configuration Macros]
|
||||
|
||||
When BOOST_NO_STATIC_ASSERT is defined, the user can select the way static assertions are reported. Define
|
||||
|
||||
* BOOST_RATIO_USES_STATIC_ASSERT to use Boost.StaticAssert.
|
||||
* BOOST_RATIO_USES_MPL_ASSERT to use [*Boost.MPL] static assertions.
|
||||
* BOOST_RATIO_USES_RATIO_ASSERT to use __Boost_Ratio static assertions.
|
||||
|
||||
The default behavior is as if BOOST_RATIO_USES_ARRAY_ASSERT is defined.
|
||||
|
||||
When BOOST_RATIO_USES_MPL_ASSERT is not defined the following symbols are defined as shown:
|
||||
|
||||
#define BOOST_RATIO_OVERFLOW_IN_ADD "overflow in ratio add"
|
||||
#define BOOST_RATIO_OVERFLOW_IN_SUB "overflow in ratio sub"
|
||||
#define BOOST_RATIO_OVERFLOW_IN_MUL "overflow in ratio mul"
|
||||
#define BOOST_RATIO_OVERFLOW_IN_DIV "overflow in ratio div"
|
||||
#define BOOST_RATIO_NUMERATOR_IS_OUT_OF_RANGE "ratio numerator is out of range"
|
||||
#define BOOST_RATIO_DIVIDE_BY_0 "ratio divide by 0"
|
||||
#define BOOST_RATIO_DENOMINATOR_IS_OUT_OF_RANGE "ratio denominator is out of range"
|
||||
|
||||
Depending upon the static assertion system used, a hint as to the failing assertion will appear in some form in the compiler diagnostic output.
|
||||
|
||||
When BOOST_RATIO_EXTENSIONS is defined, __Boost_Ratio provides in addition some extenion to the C++ standard, see below.
|
||||
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:ratio Class Template `ratio<>`]
|
||||
|
||||
template <boost::intmax_t N, boost::intmax_t D>
|
||||
@ -756,7 +787,7 @@ When BOOST_RATIO_EXTENSIONS is defined, __Boost_Ratio provides in addition some
|
||||
static const boost::intmax_t den;
|
||||
typedef ratio<num, den> type;
|
||||
|
||||
#ifdef BOOST_RATIO_EXTENSIONS
|
||||
#ifdef __BOOST_RATIO_EXTENSIONS
|
||||
typedef mpl::rational_c_tag tag;
|
||||
typedef boost::rational<boost::intmax_t> value_type;
|
||||
typedef boost::intmax_t num_type;
|
||||
@ -790,7 +821,7 @@ Two __ratio classes `__ratio<N1,D1>` and `__ratio<N2,D2>` have the same normaliz
|
||||
|
||||
[section:ca Construction and Assignment]
|
||||
|
||||
Included only if BOOST_RATIO_EXTENSIONS is defined.
|
||||
Included only if __BOOST_RATIO_EXTENSIONS is defined.
|
||||
|
||||
[heading Default Constructor]
|
||||
|
||||
@ -822,7 +853,7 @@ Included only if BOOST_RATIO_EXTENSIONS is defined.
|
||||
|
||||
[section:mpl MPL Numeric Metafunctions]
|
||||
|
||||
Included only if BOOST_RATIO_EXTENSIONS is defined.
|
||||
Included only if __BOOST_RATIO_EXTENSIONS is defined.
|
||||
|
||||
In order to work with [*Boost.MPL] numeric metafunctions as a __Rational_Constant, the following has beed added:
|
||||
|
||||
@ -834,7 +865,7 @@ In order to work with [*Boost.MPL] numeric metafunctions as a __Rational_Constan
|
||||
|
||||
[section:obs Observers]
|
||||
|
||||
Included only if BOOST_RATIO_EXTENSIONS is defined.
|
||||
Included only if __BOOST_RATIO_EXTENSIONS is defined.
|
||||
|
||||
static value_type value();
|
||||
value_type operator()() const;
|
||||
@ -1031,14 +1062,236 @@ When __BOOST_RATIO_EXTENSIONS is defined __Boost_Ratio provides the following ex
|
||||
This header provides `ratio_string<>` which can generate a textual representation of a `ratio<>` in the form of a `std::basic_string<>`. These strings can be useful for I/O.
|
||||
|
||||
namespace boost {
|
||||
template <class Ratio, class charT> struct ratio_string;
|
||||
|
||||
template <> struct ratio_string<atto, char>;
|
||||
template <> struct ratio_string<atto, char16_t>;
|
||||
template <> struct ratio_string<atto, char32_t>;
|
||||
template <> struct ratio_string<atto, wchar_t>;
|
||||
|
||||
template <> struct ratio_string<femto, char>;
|
||||
template <> struct ratio_string<femto, char16_t>;
|
||||
template <> struct ratio_string<femto, char32_t>;
|
||||
template <> struct ratio_string<femto, wchar_t>;
|
||||
|
||||
template <> struct ratio_string<pico, char>;
|
||||
template <> struct ratio_string<pico, char16_t>;
|
||||
template <> struct ratio_string<pico, char32_t>;
|
||||
template <> struct ratio_string<pico, wchar_t>;
|
||||
|
||||
template <> struct ratio_string<nano, char>;
|
||||
template <> struct ratio_string<nano, char16_t>;
|
||||
template <> struct ratio_string<nano, char32_t>;
|
||||
template <> struct ratio_string<nano, wchar_t>;
|
||||
|
||||
template <> struct ratio_string<micro, char>;
|
||||
template <> struct ratio_string<micro, char16_t>;
|
||||
template <> struct ratio_string<micro, char32_t>;
|
||||
template <> struct ratio_string<micro, wchar_t>;
|
||||
|
||||
template <> struct ratio_string<milli, char>;
|
||||
template <> struct ratio_string<milli, char16_t>;
|
||||
template <> struct ratio_string<milli, char32_t>;
|
||||
template <> struct ratio_string<milli, wchar_t>;
|
||||
|
||||
template <> struct ratio_string<centi, char>;
|
||||
template <> struct ratio_string<centi, char16_t>;
|
||||
template <> struct ratio_string<centi, char32_t>;
|
||||
template <> struct ratio_string<centi, wchar_t>;
|
||||
|
||||
template <> struct ratio_string<deci, char>;
|
||||
template <> struct ratio_string<deci, char16_t>;
|
||||
template <> struct ratio_string<deci, char32_t>;
|
||||
template <> struct ratio_string<deci, wchar_t>;
|
||||
|
||||
template <> struct ratio_string<deca, char>;
|
||||
template <> struct ratio_string<deca, char16_t>;
|
||||
template <> struct ratio_string<deca, char32_t>;
|
||||
template <> struct ratio_string<deca, wchar_t>;
|
||||
|
||||
template <> struct ratio_string<hecto, char>;
|
||||
template <> struct ratio_string<hecto, char16_t>;
|
||||
template <> struct ratio_string<hecto, char32_t>;
|
||||
template <> struct ratio_string<hecto, wchar_t>;
|
||||
|
||||
template <> struct ratio_string<kilo, char>;
|
||||
template <> struct ratio_string<kilo, char16_t>;
|
||||
template <> struct ratio_string<kilo, char32_t>;
|
||||
template <> struct ratio_string<kilo, wchar_t>;
|
||||
|
||||
template <> struct ratio_string<mega, char>;
|
||||
template <> struct ratio_string<mega, char16_t>;
|
||||
template <> struct ratio_string<mega, char32_t>;
|
||||
template <> struct ratio_string<mega, wchar_t>;
|
||||
|
||||
template <> struct ratio_string<giga, char>;
|
||||
template <> struct ratio_string<giga, char16_t>;
|
||||
template <> struct ratio_string<giga, char32_t>;
|
||||
template <> struct ratio_string<giga, wchar_t>;
|
||||
|
||||
template <> struct ratio_string<tera, char>;
|
||||
template <> struct ratio_string<tera, char16_t>;
|
||||
template <> struct ratio_string<tera, char32_t>;
|
||||
template <> struct ratio_string<tera, wchar_t>;
|
||||
|
||||
template <> struct ratio_string<peta, char>;
|
||||
template <> struct ratio_string<peta, char16_t>;
|
||||
template <> struct ratio_string<peta, char32_t>;
|
||||
template <> struct ratio_string<peta, wchar_t>;
|
||||
|
||||
template <> struct ratio_string<exa, char>;
|
||||
template <> struct ratio_string<exa, char16_t>;
|
||||
template <> struct ratio_string<exa, char32_t>;
|
||||
template <> struct ratio_string<exa, wchar_t>;
|
||||
}
|
||||
|
||||
[section:ratio_string Template Class `ratio_string<>`]
|
||||
|
||||
template <class Ratio, class CharT>
|
||||
struct ratio_string
|
||||
{
|
||||
static std::basic_string<CharT> short_name();
|
||||
static std::basic_string<CharT> long_name();
|
||||
static std::basic_string<CharT> symbol();
|
||||
static std::basic_string<CharT> prefix();
|
||||
static std::basic_string<CharT> short_name(); // DEPRECATED V2
|
||||
static std::basic_string<CharT> long_name(); // DEPRECATED V2
|
||||
};
|
||||
}
|
||||
|
||||
The class template ratio_string provides textual representations of the associated ratio appropriate for the character type charT.
|
||||
|
||||
The primary template provides generic strings. Specializations provide the same static member functions but these functions return the English SI prefix and symbol names as specified by the General Conference on Weights and Measures.
|
||||
|
||||
[section:prefix Static Member function `prefix()`]
|
||||
|
||||
template<class Ratio, class CharT>
|
||||
basic_string<charT>
|
||||
ratio_string<Ratio, CharT>::prefix();
|
||||
|
||||
[*Returns]: A basic_string of the form: [Ratio::num/Ratio::den]
|
||||
|
||||
[*Example]: `ratio_string<ratio<2, 60>, wchar_t>::prefix()` returns `L"[1/30]"`.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:symbol Static Member function `symbol()`]
|
||||
|
||||
template<class Ratio, class CharT>
|
||||
basic_string<charT>
|
||||
ratio_string<Ratio, CharT>::symbol();
|
||||
|
||||
[*Returns]: prefix().
|
||||
|
||||
|
||||
[endsect]
|
||||
[section:long_name Static Member function `long_name()` DEPRECATED V2]
|
||||
|
||||
template<class Ratio, class CharT>
|
||||
basic_string<charT>
|
||||
ratio_string<Ratio, CharT>::long_name();
|
||||
|
||||
[*Returns]: prefix().
|
||||
|
||||
[endsect]
|
||||
[section:short_name Static Member function `short_name()` DEPRECATED V2]
|
||||
|
||||
template<class Ratio, class CharT>
|
||||
basic_string<charT>
|
||||
ratio_string<Ratio, CharT>::short_name();
|
||||
|
||||
[*Returns]: symbol().
|
||||
|
||||
[endsect]
|
||||
[endsect]
|
||||
|
||||
|
||||
[section:spe Specializations for `ratio_string<>`]
|
||||
|
||||
For each specialization the table gives the return value for `prefix()` and `symbol()`.
|
||||
|
||||
[table The return values of specializations of ratio_string
|
||||
[[Specialization][`prefix()`] [`symbol()`]]
|
||||
[[`ratio_string<atto, char>`][`"atto"`] [`"a"`]]
|
||||
[[`ratio_string<atto, char16_t>`][`u"atto"`] [`u"a"`]]
|
||||
[[`ratio_string<atto, char32_t>`][`U"atto"`] [`U"a"`]]
|
||||
[[`ratio_string<atto, wchar_t>`][`L"atto"`] [`L"a"`]]
|
||||
|
||||
[[`ratio_string<femto, char>`][`"femto"`] [`"f"`]]
|
||||
[[`ratio_string<femto, char16_t>`][`u"femto"`] [`u"f"`]]
|
||||
[[`ratio_string<femto, char32_t>`][`U"femto"`] [`U"f"`]]
|
||||
[[`ratio_string<femto, wchar_t>`][`L"femto"`] [`L"f"`]]
|
||||
|
||||
[[`ratio_string<pico, char>`][`"pico"`] [`"p"`]]
|
||||
[[`ratio_string<pico, char16_t>`][`u"pico"`] [`u"p"`]]
|
||||
[[`ratio_string<pico, char32_t>`][`U"pico"`] [`U"p"`]]
|
||||
[[`ratio_string<pico, wchar_t>`][`L"pico"`] [`L"p"`]]
|
||||
|
||||
[[`ratio_string<nano, char>`][`"nano"`] [`"a"`]]
|
||||
[[`ratio_string<nano, char16_t>`][`u"nano"`] [`u"a"`]]
|
||||
[[`ratio_string<nano, char32_t>`][`U"nano"`] [`U"a"`]]
|
||||
[[`ratio_string<nano, wchar_t>`][`L"nano"`] [`L"a"`]]
|
||||
|
||||
[[`ratio_string<micro, char>`][`"micro"`] [`u8"\u00B5"`]]
|
||||
[[`ratio_string<micro, char16_t>`][`u"micro"`] [`u"\u00B5"`]]
|
||||
[[`ratio_string<micro, char32_t>`][`U"micro"`] [`U"\u00B5"`]]
|
||||
[[`ratio_string<micro, wchar_t>`][`L"micro"`] [`Lu8"\u00B5"`]]
|
||||
|
||||
[[`ratio_string<milli, char>`][`"milli"`] [`"m"`]]
|
||||
[[`ratio_string<milli, char16_t>`][`u"milli"`] [`u"m"`]]
|
||||
[[`ratio_string<milli, char32_t>`][`U"milli"`] [`U"m"`]]
|
||||
[[`ratio_string<milli, wchar_t>`][`L"milli"`] [`L"m"`]]
|
||||
|
||||
[[`ratio_string<centi, char>`][`"centi"`] [`"c"`]]
|
||||
[[`ratio_string<centi, char16_t>`][`u"centi"`] [`u"c"`]]
|
||||
[[`ratio_string<centi, char32_t>`][`U"centi"`] [`U"c"`]]
|
||||
[[`ratio_string<centi, wchar_t>`][`L"centi"`] [`L"c"`]]
|
||||
|
||||
[[`ratio_string<deci, char>`][`"deci"`] [`"d"`]]
|
||||
[[`ratio_string<deci, char16_t>`][`u"deci"`] [`u"d"`]]
|
||||
[[`ratio_string<deci, char32_t>`][`U"deci"`] [`U"d"`]]
|
||||
[[`ratio_string<deci, wchar_t>`][`L"deci"`] [`L"d"`]]
|
||||
|
||||
[[`ratio_string<deca, char>`][`"deca"`] [`"da"`]]
|
||||
[[`ratio_string<deca, char16_t>`][`u"deca"`] [`u"da"`]]
|
||||
[[`ratio_string<deca, char32_t>`][`U"deca"`] [`U"da"`]]
|
||||
[[`ratio_string<deca, wchar_t>`][`L"deca"`] [`L"da"`]]
|
||||
|
||||
[[`ratio_string<hecto, char>`][`"hecto"`] [`"h"`]]
|
||||
[[`ratio_string<hecto, char16_t>`][`u"hecto"`] [`u"h"`]]
|
||||
[[`ratio_string<hecto, char32_t>`][`U"hecto"`] [`U"h"`]]
|
||||
[[`ratio_string<hecto, wchar_t>`][`L"hecto"`] [`L"h"`]]
|
||||
|
||||
[[`ratio_string<kilo, char>`][`"kilo"`] [`"k"`]]
|
||||
[[`ratio_string<kilo, char16_t>`][`u"kilo"`] [`u"k"`]]
|
||||
[[`ratio_string<kilo, char32_t>`][`U"kilo"`] [`U"k"`]]
|
||||
[[`ratio_string<kilo, wchar_t>`][`L"kilo"`] [`L"k"`]]
|
||||
|
||||
[[`ratio_string<mega, char>`][`"mega"`] [`"M"`]]
|
||||
[[`ratio_string<mega, char16_t>`][`u"mega"`] [`u"M"`]]
|
||||
[[`ratio_string<mega, char32_t>`][`U"mega"`] [`U"M"`]]
|
||||
[[`ratio_string<mega, wchar_t>`][`L"mega"`] [`L"M"`]]
|
||||
|
||||
[[`ratio_string<giga, char>`][`"giga"`] [`"G"`]]
|
||||
[[`ratio_string<giga, char16_t>`][`u"giga"`] [`u"G"`]]
|
||||
[[`ratio_string<giga, char32_t>`][`U"giga"`] [`U"G"`]]
|
||||
[[`ratio_string<giga, wchar_t>`][`L"giga"`] [`L"G"`]]
|
||||
|
||||
[[`ratio_string<tera, char>`][`"tera"`] [`"T"`]]
|
||||
[[`ratio_string<tera, char16_t>`][`u"tera"`] [`u"T"`]]
|
||||
[[`ratio_string<tera, char32_t>`][`U"tera"`] [`U"T"`]]
|
||||
[[`ratio_string<tera, wchar_t>`][`L"tera"`] [`L"T"`]]
|
||||
|
||||
[[`ratio_string<peta, char>`][`"peta"`] [`"P"`]]
|
||||
[[`ratio_string<peta, char16_t>`][`u"peta"`] [`u"P"`]]
|
||||
[[`ratio_string<peta, char32_t>`][`U"peta"`] [`U"P"`]]
|
||||
[[`ratio_string<peta, wchar_t>`][`L"peta"`] [`L"P"`]]
|
||||
|
||||
[[`ratio_string<exa, char>`][`"exa"`] [`"E"`]]
|
||||
[[`ratio_string<exa, char16_t>`][`u"exa"`] [`u"E"`]]
|
||||
[[`ratio_string<exa, char32_t>`][`U"exa"`] [`U"E"`]]
|
||||
[[`ratio_string<exa, wchar_t>`][`L"exa"`] [`L"E"`]]
|
||||
|
||||
]
|
||||
|
||||
[endsect]
|
||||
[endsect]
|
||||
[endsect]
|
||||
[section:mpl Rational Constant]
|
||||
@ -1596,6 +1849,18 @@ The specialization relays on the __ratio_greater_equal template class.
|
||||
[section:history Appendix A: History]
|
||||
[/==================================]
|
||||
|
||||
[section [*Version 2.0.0, November 1, 2012 - 1.52] ]
|
||||
|
||||
[*Features:]
|
||||
|
||||
* [@http://svn.boost.org/trac/boost/ticket/XXXX #XXXX] Replace the short_name and long_name functions by symbol and prefix functions respectively.
|
||||
|
||||
[*Deprecated:]
|
||||
|
||||
The ratio_string<>::short_name and ratio_string<>::long_name are deprecated. Use ratio_string<>::symbol and ratio_string<>::prefix respectively. These functions be removed in 1.55.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section [*Version 1.0.3, August 1, 2012 - 1.51] ]
|
||||
|
||||
[*Fixes:]
|
||||
|
@ -19,21 +19,21 @@ int main()
|
||||
using namespace std;
|
||||
using namespace boost;
|
||||
|
||||
cout << "ratio_string<deca, char>::long_name() = "
|
||||
<< ratio_string<boost::deca, char>::long_name() << '\n';
|
||||
cout << "ratio_string<deca, char>::short_name() = "
|
||||
<< ratio_string<boost::deca, char>::short_name() << '\n';
|
||||
cout << "ratio_string<deca, char>::prefix() = "
|
||||
<< ratio_string<boost::deca, char>::prefix() << '\n';
|
||||
cout << "ratio_string<deca, char>::symbol() = "
|
||||
<< ratio_string<boost::deca, char>::symbol() << '\n';
|
||||
|
||||
cout << "ratio_string<giga, char>::long_name() = "
|
||||
<< ratio_string<boost::giga, char>::long_name() << '\n';
|
||||
cout << "ratio_string<giga, char>::short_name() = "
|
||||
<< ratio_string<boost::giga, char>::short_name() << '\n';
|
||||
cout << "ratio_string<giga, char>::prefix() = "
|
||||
<< ratio_string<boost::giga, char>::prefix() << '\n';
|
||||
cout << "ratio_string<giga, char>::symbol() = "
|
||||
<< ratio_string<boost::giga, char>::symbol() << '\n';
|
||||
|
||||
cout << "ratio_string<ratio<4, 6>, char>::prefix() = "
|
||||
<< ratio_string<boost::ratio<4, 6>, char>::prefix() << '\n';
|
||||
cout << "ratio_string<ratio<4, 6>, char>::symbol() = "
|
||||
<< ratio_string<boost::ratio<4, 6>, char>::symbol() << '\n';
|
||||
|
||||
cout << "ratio_string<ratio<4, 6>, char>::long_name() = "
|
||||
<< ratio_string<boost::ratio<4, 6>, char>::long_name() << '\n';
|
||||
cout << "ratio_string<ratio<4, 6>, char>::short_name() = "
|
||||
<< ratio_string<boost::ratio<4, 6>, char>::short_name() << '\n';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
75
include/boost/ratio/config.hpp
Normal file
75
include/boost/ratio/config.hpp
Normal file
@ -0,0 +1,75 @@
|
||||
// config.hpp ---------------------------------------------------------------//
|
||||
|
||||
// Copyright 2012 Vicente J. Botet Escriba
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
|
||||
#ifndef BOOST_RATIO_CONFIG_HPP
|
||||
#define BOOST_RATIO_CONFIG_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#if !defined BOOST_RATIO_VERSION
|
||||
#define BOOST_RATIO_VERSION 1
|
||||
#else
|
||||
#if BOOST_RATIO_VERSION!=1 && BOOST_RATIO_VERSION!=2
|
||||
#error "BOOST_RATIO_VERSION must be 1 or 2"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BOOST_RATIO_VERSION==1
|
||||
#if ! defined BOOST_RATIO_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V2_0_0
|
||||
#define BOOST_RATIO_PROVIDES_DEPRECATED_FEATURES_SINCE_V2_0_0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BOOST_RATIO_VERSION==2
|
||||
#if ! defined BOOST_RATIO_PROVIDES_DEPRECATED_FEATURES_SINCE_V2_0_0
|
||||
#define BOOST_RATIO_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V2_0_0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef INTMAX_C
|
||||
#define BOOST_RATIO_INTMAX_C(a) INTMAX_C(a)
|
||||
#else
|
||||
#define BOOST_RATIO_INTMAX_C(a) a##LL
|
||||
#endif
|
||||
|
||||
#define BOOST_RATIO_INTMAX_T_MAX (0x7FFFFFFFFFFFFFFELL)
|
||||
|
||||
|
||||
#ifndef BOOST_NO_CXX11_STATIC_ASSERT
|
||||
#define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) static_assert(CND,MSG)
|
||||
#elif defined(BOOST_RATIO_USES_STATIC_ASSERT)
|
||||
#include <boost/static_assert.hpp>
|
||||
#define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) BOOST_STATIC_ASSERT(CND)
|
||||
#elif defined(BOOST_RATIO_USES_MPL_ASSERT)
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) \
|
||||
BOOST_MPL_ASSERT_MSG(boost::mpl::bool_< (CND) >::type::value, MSG, TYPES)
|
||||
#else
|
||||
//~ #elif defined(BOOST_RATIO_USES_ARRAY_ASSERT)
|
||||
#define BOOST_RATIO_CONCAT(A,B) A##B
|
||||
#define BOOST_RATIO_NAME(A,B) BOOST_RATIO_CONCAT(A,B)
|
||||
#define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) static char BOOST_RATIO_NAME(__boost_ratio_test_,__LINE__)[(CND)?1:-1]
|
||||
//~ #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES)
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) || !defined(BOOST_RATIO_USES_MPL_ASSERT)
|
||||
#define BOOST_RATIO_OVERFLOW_IN_ADD "overflow in ratio add"
|
||||
#define BOOST_RATIO_OVERFLOW_IN_SUB "overflow in ratio sub"
|
||||
#define BOOST_RATIO_OVERFLOW_IN_MUL "overflow in ratio mul"
|
||||
#define BOOST_RATIO_OVERFLOW_IN_DIV "overflow in ratio div"
|
||||
#define BOOST_RATIO_NUMERATOR_IS_OUT_OF_RANGE "ratio numerator is out of range"
|
||||
#define BOOST_RATIO_DIVIDE_BY_0 "ratio divide by 0"
|
||||
#define BOOST_RATIO_DENOMINATOR_IS_OUT_OF_RANGE "ratio denominator is out of range"
|
||||
#endif
|
||||
|
||||
|
||||
//#define BOOST_RATIO_EXTENSIONS
|
||||
|
||||
#endif // header
|
@ -32,6 +32,7 @@ time2_demo contained this comment:
|
||||
#ifndef BOOST_RATIO_DETAIL_RATIO_OPERATIONS_HPP
|
||||
#define BOOST_RATIO_DETAIL_RATIO_OPERATIONS_HPP
|
||||
|
||||
#include <boost/ratio/config.hpp>
|
||||
#include <boost/ratio/detail/mpl/abs.hpp>
|
||||
#include <boost/ratio/detail/mpl/sign.hpp>
|
||||
#include <cstdlib>
|
||||
@ -42,37 +43,6 @@ time2_demo contained this comment:
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/integer_traits.hpp>
|
||||
|
||||
#define BOOST_RATIO_INTMAX_T_MAX (0x7FFFFFFFFFFFFFFELL)
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) || !defined(BOOST_RATIO_USES_MPL_ASSERT)
|
||||
#define BOOST_RATIO_OVERFLOW_IN_ADD "overflow in ratio add"
|
||||
#define BOOST_RATIO_OVERFLOW_IN_SUB "overflow in ratio sub"
|
||||
#define BOOST_RATIO_OVERFLOW_IN_MUL "overflow in ratio mul"
|
||||
#define BOOST_RATIO_OVERFLOW_IN_DIV "overflow in ratio div"
|
||||
#define BOOST_RATIO_NUMERATOR_IS_OUT_OF_RANGE "ratio numerator is out of range"
|
||||
#define BOOST_RATIO_DIVIDE_BY_0 "ratio divide by 0"
|
||||
#define BOOST_RATIO_DENOMINATOR_IS_OUT_OF_RANGE "ratio denominator is out of range"
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_CXX11_STATIC_ASSERT
|
||||
#define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) static_assert(CND,MSG)
|
||||
#elif defined(BOOST_RATIO_USES_STATIC_ASSERT)
|
||||
#include <boost/static_assert.hpp>
|
||||
#define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) BOOST_STATIC_ASSERT(CND)
|
||||
#elif defined(BOOST_RATIO_USES_MPL_ASSERT)
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) \
|
||||
BOOST_MPL_ASSERT_MSG(boost::mpl::bool_< (CND) >::type::value, MSG, TYPES)
|
||||
#else
|
||||
//~ #elif defined(BOOST_RATIO_USES_ARRAY_ASSERT)
|
||||
#define BOOST_RATIO_CONCAT(A,B) A##B
|
||||
#define BOOST_RATIO_NAME(A,B) BOOST_RATIO_CONCAT(A,B)
|
||||
#define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) static char BOOST_RATIO_NAME(__boost_ratio_test_,__LINE__)[(CND)?1:-1]
|
||||
//~ #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES)
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// We simply cannot include this header on gcc without getting copious warnings of the kind:
|
||||
//
|
||||
|
1043
include/boost/ratio/detail/ratio_io.hpp
Normal file
1043
include/boost/ratio/detail/ratio_io.hpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -32,7 +32,7 @@ time2_demo contained this comment:
|
||||
#ifndef BOOST_RATIO_RATIO_HPP
|
||||
#define BOOST_RATIO_RATIO_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/ratio/config.hpp>
|
||||
#include <boost/ratio/detail/mpl/abs.hpp>
|
||||
#include <boost/ratio/detail/mpl/sign.hpp>
|
||||
#include <boost/ratio/detail/mpl/gcd.hpp>
|
||||
|
@ -32,12 +32,7 @@ time2_demo contained this comment:
|
||||
#ifndef BOOST_RATIO_RATIO_FWD_HPP
|
||||
#define BOOST_RATIO_RATIO_FWD_HPP
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#ifdef INTMAX_C
|
||||
#define BOOST_RATIO_INTMAX_C(a) INTMAX_C(a)
|
||||
#else
|
||||
#define BOOST_RATIO_INTMAX_C(a) a##LL
|
||||
#endif
|
||||
#include <boost/ratio/config.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@ -82,7 +77,7 @@ typedef ratio< BOOST_RATIO_INTMAX_C(1000000000), BOOST_RATIO_INTMAX_C(1)
|
||||
typedef ratio< BOOST_RATIO_INTMAX_C(1000000000000), BOOST_RATIO_INTMAX_C(1)> tera;
|
||||
typedef ratio< BOOST_RATIO_INTMAX_C(1000000000000000), BOOST_RATIO_INTMAX_C(1)> peta;
|
||||
typedef ratio<BOOST_RATIO_INTMAX_C(1000000000000000000), BOOST_RATIO_INTMAX_C(1)> exa;
|
||||
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -26,6 +26,7 @@ project
|
||||
<toolset>msvc:<asynch-exceptions>on
|
||||
<define>BOOST_ENABLE_WARNINGS
|
||||
<define>BOOST_RATIO_USES_MPL_ASSERT
|
||||
<define>BOOST_RATIO_VERSION=2
|
||||
<define>BOOST_MPL_NEXT_PRIOR_EXT
|
||||
#<toolset>sun:<define>BOOST_COMMON_TYPE_DONT_USE_TYPEOF
|
||||
#<toolset>sun:<define>BOOST_TYPEOF_EMULATION
|
||||
|
@ -17,6 +17,6 @@
|
||||
typedef boost::ratio_string<int, char> R1;
|
||||
|
||||
void test() {
|
||||
|
||||
std::string str = R1::short_name();
|
||||
|
||||
std::string str = R1::symbol();
|
||||
}
|
||||
|
@ -22,130 +22,130 @@ int main()
|
||||
|
||||
{
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::atto, char>::long_name() == "atto"
|
||||
boost::ratio_string<boost::atto, char>::prefix() == "atto"
|
||||
));
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::atto, char>::short_name() == "a"
|
||||
boost::ratio_string<boost::atto, char>::symbol() == "a"
|
||||
));
|
||||
}
|
||||
{
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::femto, char>::long_name() == "femto"
|
||||
boost::ratio_string<boost::femto, char>::prefix() == "femto"
|
||||
));
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::femto, char>::short_name() == "f"
|
||||
boost::ratio_string<boost::femto, char>::symbol() == "f"
|
||||
));
|
||||
}
|
||||
{
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::pico, char>::long_name() == "pico"
|
||||
boost::ratio_string<boost::pico, char>::prefix() == "pico"
|
||||
));
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::pico, char>::short_name() == "p"
|
||||
boost::ratio_string<boost::pico, char>::symbol() == "p"
|
||||
));
|
||||
}
|
||||
{
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::nano, char>::long_name() == "nano"
|
||||
boost::ratio_string<boost::nano, char>::prefix() == "nano"
|
||||
));
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::nano, char>::short_name() == "n"
|
||||
boost::ratio_string<boost::nano, char>::symbol() == "n"
|
||||
));
|
||||
}
|
||||
{
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::micro, char>::long_name() == "micro"
|
||||
boost::ratio_string<boost::micro, char>::prefix() == "micro"
|
||||
));
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::micro, char>::short_name() == "\xC2\xB5"
|
||||
boost::ratio_string<boost::micro, char>::symbol() == "\xC2\xB5"
|
||||
));
|
||||
}
|
||||
{
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::milli, char>::long_name() == "milli"
|
||||
boost::ratio_string<boost::milli, char>::prefix() == "milli"
|
||||
));
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::milli, char>::short_name() == "m"
|
||||
boost::ratio_string<boost::milli, char>::symbol() == "m"
|
||||
));
|
||||
}
|
||||
{
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::centi, char>::long_name() == "centi"
|
||||
boost::ratio_string<boost::centi, char>::prefix() == "centi"
|
||||
));
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::centi, char>::short_name() == "c"
|
||||
boost::ratio_string<boost::centi, char>::symbol() == "c"
|
||||
));
|
||||
}
|
||||
{
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::deci, char>::long_name() == "deci"
|
||||
boost::ratio_string<boost::deci, char>::prefix() == "deci"
|
||||
));
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::deci, char>::short_name() == "d"
|
||||
boost::ratio_string<boost::deci, char>::symbol() == "d"
|
||||
));
|
||||
}
|
||||
{
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::deca, char>::long_name() == "deca"
|
||||
boost::ratio_string<boost::deca, char>::prefix() == "deca"
|
||||
));
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::deca, char>::short_name() == "da"
|
||||
boost::ratio_string<boost::deca, char>::symbol() == "da"
|
||||
));
|
||||
}
|
||||
{
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::hecto, char>::long_name() == "hecto"
|
||||
boost::ratio_string<boost::hecto, char>::prefix() == "hecto"
|
||||
));
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::hecto, char>::short_name() == "h"
|
||||
boost::ratio_string<boost::hecto, char>::symbol() == "h"
|
||||
));
|
||||
}
|
||||
{
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::kilo, char>::long_name() == "kilo"
|
||||
boost::ratio_string<boost::kilo, char>::prefix() == "kilo"
|
||||
));
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::kilo, char>::short_name() == "k"
|
||||
boost::ratio_string<boost::kilo, char>::symbol() == "k"
|
||||
));
|
||||
}
|
||||
{
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::mega, char>::long_name() == "mega"
|
||||
boost::ratio_string<boost::mega, char>::prefix() == "mega"
|
||||
));
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::mega, char>::short_name() == "M"
|
||||
boost::ratio_string<boost::mega, char>::symbol() == "M"
|
||||
));
|
||||
}
|
||||
{
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::giga, char>::long_name() == "giga"
|
||||
boost::ratio_string<boost::giga, char>::prefix() == "giga"
|
||||
));
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::giga, char>::short_name() == "G"
|
||||
boost::ratio_string<boost::giga, char>::symbol() == "G"
|
||||
));
|
||||
}
|
||||
{
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::tera, char>::long_name() == "tera"
|
||||
boost::ratio_string<boost::tera, char>::prefix() == "tera"
|
||||
));
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::tera, char>::short_name() == "T"
|
||||
boost::ratio_string<boost::tera, char>::symbol() == "T"
|
||||
));
|
||||
}
|
||||
{
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::peta, char>::long_name() == "peta"
|
||||
boost::ratio_string<boost::peta, char>::prefix() == "peta"
|
||||
));
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::peta, char>::short_name() == "P"
|
||||
boost::ratio_string<boost::peta, char>::symbol() == "P"
|
||||
));
|
||||
}
|
||||
{
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::exa, char>::long_name() == "exa"
|
||||
boost::ratio_string<boost::exa, char>::prefix() == "exa"
|
||||
));
|
||||
BOOST_TEST((
|
||||
boost::ratio_string<boost::exa, char>::short_name() == "E"
|
||||
boost::ratio_string<boost::exa, char>::symbol() == "E"
|
||||
));
|
||||
}
|
||||
// return 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user