|
Boost : |
From: Dan W. (danw_at_[hidden])
Date: 2004-01-09 14:04:28
Matthias Schabel wrote:
> This absolute vs. relative quantity issues arises pretty much
> everywhere. For example,
> if I have two points along the x-axis, one at 7 meters and another at
> 12 meters, what does
> it mean to add the two? Nothing really. We can add an increment in
> distance to either one,
> to get a new absolute position or we could add two increments to get
> another increment, but
> adding two absolute quantities doesn't really make sense. In the same
> way, if I write
>
> 32*_fahrenheit+32*_fahrenheit = 64*_fahrenheit
>
> it makes perfect sense if one or both of the terms on the left is a
> relative quantity, but not
> if both are absolutes...
That's right. I'd define a Farenheit_diff such that
Farenheit + Farenheit_diff -> Farenheit; ok
Farenheit + Farenheit -> ERROR;
Farenheit_diff + Farenheit_diff -> Farenheit_diff; ok
Same thing goes for Date and days_diff, point3d and vector3d, etc.
So, it would be unwise to allow addition of apples and apples by
default... :)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk