Boost logo

Boost :

From: Phil Richards (news_at_[hidden])
Date: 2004-01-17 11:05:35


On Sat, 17 Jan 2004 16:21:10 +0100, Jan Langer wrote:
[with regards to relative and absolute values]
> i still think this issue should not be dealt with by means of the core
> dimensions lib. so i typed a little class which should be able to restrict
> the operations allowed on absolute and relative values.

I agree.

> since all operations are allowed on relative types, there is imho no need
> of a distinct type for them.

Agreed. In fact, you could view any of the units libraries currently
described as being a "relative units library" (not that I'm suggesting
renaming them).

> normally something like this could be plugged into the dimensions lib
> and everything could work as expected:
> typedef ... kelvin;
> absolute <kelvin> freezing_point (273.15); absolute <kelvin>
> boiling_point = freezing_point + 100 * kelvin; kelvin temp_diff =
> boiling_point - freezing_point;
> freezing_point + boiling_point; // error
> a similar approach should imho be followed to support the affine and
> non-linear measures.

This I like - I think it works in practice as well as being rather tidy.
I think with a bit of playing around, we could slot the boost::date_time
library in for "absolute time" - or maybe we just have suitable
specialisations for absolute<>?

Anyway, as I said, I like it.

phil

-- 
change name before "@" to "phil" for email

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