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