type.coerce ≡
template <typename T> inline T reinterpret_cast(auto x) §
Forcibly convert the input type to the output type T.
This overrides any compile-time check from the built-in
cast operator by casting the input to an intermediate
uint type before casting to T. If
T is wider than the input, then due to the intermediate
trip through uint the result is zero extended. If
T is narrower than the input, truncate the most-significant
bits.
Parameters
-
typename TOutput
template <typename T> inline T static_cast(auto x) §
A wrapper around the built-in cast operator, allowing it
to be used as a function
template <typename T> inline T checked_cast(auto x) §
cast then assert that the output equals the
input.
template <typename To, typename From> inline optional<To> safe_cast(From input) §
Cast a value from type From to type To and
return whether the cast was done without losing information. For
example, the uint32 value 255 can be cast to a
uint8 without losing information, but casting the
uint32 value 257 to a uint8 is
lossy.