|
Boost : |
From: Deane Yang (deane_yang_at_[hidden])
Date: 2007-03-26 14:14:00
Zach Laine wrote:
>
> Specifically,
>
> quantity<force> F(2.0*newton);
> quantity<length> dx(2.0*meter);
> F.value() = dx.value();
>
> is an abomination and should be impossible. If I really want to do
> this, why not make me go through the constructor, so that attention is
> more obviously called to what I'm doing? I could also live with using
> a purposely ugly cast here, but since quantity_cast() has some
> perfectly legitimate and safe uses, I would much prefer a different
> syntax that draws attention to this unsafe act, such as
> quantity_reinterpret_cast().
I agree completely with Zach's views on this. It's OK to have a const
member function .value() but not a mutating one.
>
> I and a lot of other users badly need support for Imperial units. As
> it stands now, we will each be required to write nearly identical code
> to do so. This should be included in the library.
>
Matthias Schabel wrote:
>
> The problem with these non-standard units is that they don't really
> form a
> well-defined unit system. ...
> We have, however, supplied a number of examples of how to
> roll your own unit system...
> )
I agree with Zach and also want to be able to define units without
having to "roll my own unit system".
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk