Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2003-11-16 02:29:40


On 11/13/03 11:30 AM, "Andy Little" <andy_at_[hidden]> wrote:

> "Daryle Walker" <darylew_at_[hidden]> wrote in message
> news:BBD8B7C7.27CC%darylew_at_hotmail.com...
>> On 11/6/03 8:33 PM, "Andy Little" <andy_at_[hidden]> wrote:
>>
>>> "Deane Yang" <deane_yang_at_[hidden]> wrote in message
>>> news:boekps$3rl$1_at_sea.gmane.org...
>>>> I want to know why it is useful to be able to add two quantities with
>>>> different units and have the operator+ do the unit conversion inside of it.
>>>> I'm sure there's an obvious answer that will make me feel very dumb.
>>>
>>> There is a very obvious answer:
>>> from , random book close at hand:
>>> Ross Garrett "The symmettry of sailing ,1987 Appendix B"
>>> Length m km inch foot nautical mile
>>> 1 metre = 1 10-3 39.37 3.281 5.4x10-4
>>> 1 kilometre = ......
>>> etc.
>>>
>>> The = sign says it all.
>>
>> No it doesn't.
>
> Oh ...yes ... it ... Does. :-)

It depends on how you see the "=" token. See below.

>>> 1 metre is equal to 1000mm
>>> is equal to etc...
>>> They are all different ways of saying the same thing. Its an everyday thing,
>>> a commonly understood concept. If you have =, you soon need +, * ... etc
>>
>> Yikes! The "=" in the table has nothing to do with the one for C++ ("is
>> equivalent to" vs. "assignment").
>
> hmm... Did I say "The Symmetry of Sailing " is written in C++ ?
>
>> In fact, the table "=" is a writing
>> convention and has no algorithmic meaning (unlike C++'s "=" or "==").
>
> ????...
[TRUNCATE]

I was worried that you saw the "=" in the table and decided to blindly map
it to an assignment operator (because it has the same symbol). From your
usage examples, I see that you aren't using it like assignment, you're using
it as an implicit conversion constructor (that's what a "=" in a definition
statement is).

Daryle


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