cpp/numeric/bit cast

Obtain a value of type by reinterpreting the object representation of. Every bit in the value representation of the returned object is equal to the corresponding bit in the object representation of. The values of padding bits in the returned object are unspecified.

If there is no value of type corresponding to the value representation produced, the behavior is undefined. If there are multiple such values, which value is produced is unspecified.

A bit in the value representation of the result is indeterminate if it
 * does not correspond to a bit in the value representation of (i.e. it corresponds to a padding bit), or
 * corresponds to a bit of an object that is not within its lifetime, or
 * has an indeterminate value.

For each bit in the value representation of the result that is indeterminate, the smallest object containing that bit has an indeterminate value; the behavior is undefined unless that object is of or std type. The result does not otherwise contain any indeterminate values.

.

This function template is if and only if each of,  and the types of all subobjects of  and :
 * is not a union type;
 * is not a pointer type;
 * is not a pointer to member type;
 * is not a volatile-qualified type; and
 * has no non-static data member of reference type.

Return value
An object of type whose value representation is as described above.

Possible implementation
To implement, ignoring the fact that it's constexpr, std can be used, when it is needed, to interpret the object representation as one of another type: