Boost logo

Boost :

Subject: Re: [boost] [ratio] Mini-review of the proposed ratio library
From: Beman Dawes (bdawes_at_[hidden])
Date: 2010-10-02 08:11:13


On Fri, Oct 1, 2010 at 12:33 PM, Howard Hinnant
<howard.hinnant_at_[hidden]> wrote:
> 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:
>
> http://home.roadrunner.com/~hinnant/duration_io/chrono_io.html
>
> In a nutshell, this addition is so that you can say:
>
>   cout << ms;
>
> instead of:
>
>   cout << ms.count() << " milliseconds";
>
> to get:
>
>   13 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>.
>
> http://home.roadrunner.com/~hinnant/duration_io/ratio_io.html

One of the advantages of Boost is that we can add extensions and get
user experience before something gets standardized. That's very
helpful to the C++ committee.

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk