Subject: Re: [boost] [ratio] Mini-review of the proposed ratio library
From: Howard Hinnant (howard.hinnant_at_[hidden])
Date: 2010-10-01 12:33:55
On Sep 30, 2010, at 9:03 PM, Beman Dawes wrote:
>> The review of Vicente Botet' Ratio library starts October 2nd and lasts
>> until October 11th, 2010, unless an extension occurs.
>> What is it?
>> Portable implementation of the C++0x Standard Library's compile-time
>> rational arithmetic working on C++03 and C++0x compilers. See the
>> current C++0x working draft at
>> - What is your evaluation of the design?
> The question is essentially moot since Vicente followed the C++0x
> standard library design. The real question is "Does Boost need a
> library that every standard library vendor will be supplying anyhow?"
> For me, the answer is, yes, at least provisionally. The provisional
> part is because the library I'd really like to see in Boost in chrono.
> But we can't have <boost/chrono.hpp> without <boost/ratio.hpp>, so I'm
> in favor of ratio.
> The reason I'd like a Boost version is that I don't want to have to
> wait years and years to be able to use <boost/chrono.hpp> and
> <boost/ratio.hpp> in Boost libraries. I want to be able to use them
> with the compilers and standard libraries people are using today, not
> years from now.
There is one wrinkle. I've been experimenting with duration I/O, and Vicente has graciously picked that up. This is not in the C++0X working draft, nor will it be proposed for C++0X ... maybe TR2. Here is my experiment:
In a nutshell, this addition is so that you can say:
cout << ms;
cout << ms.count() << " milliseconds";
Stream input is also supported. This is a more interesting problem as it entails converting run time units (those units found in the stream at run time) into compile time units (the units associated with the duration being streamed into). For example you can stream istringstream("13 milliseconds") into a std::microseconds to get 13000 microseconds.
There is an experimental <ratio_io> component, separate from <ratio>, to support the experimental <chrono_io>.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk