carb::cpp20::bit_cast
Defined in carb/cpp20/Bit.h
-
template<class To, class From, std::enable_if_t<detail::SizeMatches<To, From>::value && std::is_trivially_copyable<From>::value && std::is_trivially_copyable<To>::value, bool> = false>
To carb::cpp20::bit_cast(const From &src) Re-interprets the bits
src
as typeTo
.See: https://en.cppreference.com/w/cpp/numeric/bit_cast
Note
The
To
andFrom
types must exactly match size and both be trivially copyable.- Template Parameters
To – The object type to convert to.
From – The (typically inferred) object type to convert from.
- Parameters
src – The source object to reinterpret.
- Returns
The reinterpreted object.