
20 Jan
2007
20 Jan
'07
3:28 a.m.
However, assuming that a quantity<D,T> looks like a T in memory, reinterpret_cast should Just Work. Of course, it would let you change both D
This is true and, since this is strictly a runtime library, quantity<D,T> will just be a T in memory, so a special reinterpret cast is probably not necessary...
and T. (My thought was to have a cast that can change quantity<D,T> to and from a T.)
As Andrey points out, conversion to T can be through the value() member function and conversion from T via explicit constructor specifying the dimensions, so any cast would be redundant. That said, I don't mind a little redundancy if it increases transparency... Matthias