Boost logo

Boost :

From: Matthias Schabel (boost_at_[hidden])
Date: 2007-03-29 14:58:09


> While quantity_reinterpret_cast may not be perfectly analogous to
> reinterpret_cast, it represents the reinterpretation of a raw number
> as being of a different type, and so I think it's a pretty good name.
> Just as importantly, I can't think of anything better. Do you have
> any other ideas? quantity_unsafe_cast? quantity_arbitrary_cast? :)

Sorry, I think I muddied the waters here - I agree that
quantity_reinterpret_cast should be reserved for those cases where
access to the raw data is necessary. I was just saying that we can
write things like

quantity<SI::length,double> q;
quantity<SI::length,int> r;
quantity<CGS::length,double> s;
quantity<CGS::length,int> t;

q = quantity<SI::length,double>(r);
q = quantity<SI::length,double>(s);
q = quantity<SI::length,double>(t);

already, so the only non-degenerate use case of quantity_cast is to
take a raw value and return a quantity:

q = quantity_cast< quantity<SI::length,double> >(1.5);

Matthias


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