
19 Jan
2007
19 Jan
'07
9:05 p.m.
Hello Matthias, [snip]
For (b) the semantics really are the same as a static_cast since the only thing changing is the type, so it's dimensionally safe even if it's type-dangerous. But (a) I worry about. For something like that I'd rather see another name for the cast since it is a potential hole in the unit system – something like reinterpret_quantity_cast. (There's always reinterpret_cast for doing things that are really unsafe.)
Is it possible to overload the system reinterpret_cast, or is it not really a library function? If it was, that might be an option, too...
It's an operator and it cannot be overloaded. -- Best regards, Andrey mailto:andysem@mail.ru