The first step is the key.
esv::meric_static_cast is used to convert values between different integral,
floating point, or character types. esv::meric_static_cast is the static_cast
for esv::real_meric types.
esv::meric_static_cast:
template <esv::real_meric target_type>
constexpr inline auto meric_static_cast = esv::meric_static_cast_class<target_type>{};
Calling Sig:
#include <esvcpp/types.hpp>
constexpr auto value2 = esv::meric_static_cast<target_type>(value__);
Requirements
-
Both target_type and the type of value__ must satisfy esv::real_meric,
aka. they must be arithmetic number or esv::class_type of arithmetic
number.
-
If the target type is non-const Lvalue reference type, the nude type
of source value and the nude type of target_type must be the same type,
aka. requires:
esv::same_as<esv::remove_cvref_t<target_type>,
esv::remove_cvref_t<source_type>
.
The following types are valid source and target types:
-
esv::real_number types:
-
esv::mb
-
esv::u8
-
esv::u16
-
esv::u32
-
esv::u64
-
esv::umax
-
esv::i8
-
esv::i16
-
esv::i32
-
esv::i64
-
esv::imax
-
esv::f32
-
esv::f64
-
esv::f128
-
esv::fmax
-
char
-
unsigned char
-
char8_t
-
char16_t
-
char32_t
-
wchar_t
-
esv::real_ect types:
-
esv::mbx
-
esv::ux8
-
esv::ux16
-
esv::ux32
-
esv::ux64
-
esv::uxmax
-
esv::ix8
-
esv::ix16
-
esv::ix32
-
esv::ix64
-
esv::ixmax
-
esv::fx32
-
esv::fx64
-
esv::fx128
-
esv::fxmax
-
esv::class_type<char>
-
esv::class_type<unsigned char>
-
esv::class_type<char8_t>
-
esv::class_type<char16_t>
-
esv::class_type<char32_t>
-
esv::class_type<wchar_t>
esv::meric_static_cast can be used to convert:
-
real-ect to real-ect
-
real-number to real-ect
-
real-ect to real-number
-
real-number to real-number
esv::gnrk_static_cast
esv::meric_static_convertible
esv::real_meric
esv::ix32
esv::ux32
esv::fx32
esv::fx64