Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-09-03 08:50:12


"Jeff Garland" <jeff_at_[hidden]> writes:

> On Tue, 02 Sep 2003 18:27:59 -0400, David Abrahams wrote
>> Suppose I want to know how many minutes there are in a particular
>> duration d? My intuition says:
>>
>> d / minutes(1)
>>
>> But there's no such operator. Why not?
>
> An interesting point. Probably should be possible. While addition and
> subtraction operators are specified in terms of durations division and
> multiplication are defined with integers not other durations. I'm thinking it
> would have to be defined like this
> Duration / Duration --> Integer
>
> Anyway d.minutes() should do what you want.

I think Duration / Duration --> double would be more appropriate.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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