Boost logo

Boost Users :

Subject: Re: [Boost-users] [posix_time] time_duration operator/() overload
From: Igor R (boost.lists_at_[hidden])
Date: 2010-03-05 07:05:34


> What I'm currently doing is computing the proportions via
>
> time_duration::total_*()
>
> which works fine, but leads to some coding effort, since I'll have to cast
> one result to a real number to avoid integer division and some checks to prevent /0.

Well, you can do all this work once - in the overloaded operator :).
Note that you also have to handle special cases like pos_infinity,
neg_infinity, and some interesting situations like
pos_infinity/pos_infinity, pos_infinity/neg_infinity etc.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net