using T_To_C = std_array_to_c_arr_t<T_To>; using T_From_C = std_array_to_c_arr_t<T_From>; using T_To_El = remove_all_extents_t<T_To_C>; using T_From_El = remove_all_extents_t<T_From_C>;
if_constexpr_named(cond1, is_array_v<T_To_C> != is_array_v<T_From_C>)
{
rlbox_detail_static_fail_because(
cond1, "Conversion should not go between array and non array types");
} elseif constexpr (!is_array_v<T_To_C>)
{
convert_type_fundamental(to, from);
} else if_constexpr_named(cond2, !all_extents_same<T_To_C, T_From_C>)
{
rlbox_detail_static_fail_because(
cond2, "Conversion between arrays should have same dimensions");
} else if_constexpr_named(cond3,
is_pointer_v<T_To_El> || is_pointer_v<T_From_El>)
{
rlbox_detail_static_fail_because(cond3, "convert_type_fundamental_or_array " "does not allow arrays of pointers");
} else
{ // Explicitly using size to check for element type as we may be going across // different types of the same width such as void* and uintptr_t if constexpr (sizeof(T_To_El) == sizeof(T_From_El) &&
is_signed_v<T_To_El> == is_signed_v<T_From_El>) { // Sanity check - this should definitely be true
static_assert(sizeof(T_From_C) == sizeof(T_To_C));
std::memcpy(&to, &from, sizeof(T_To_C));
} else { for (size_t i = 0; i < std::extent_v<T_To_C>; i++) {
convert_type_fundamental_or_array(to[i], from[i]);
}
}
}
}
// Some branches don't use the param
RLBOX_UNUSED(example_unsandboxed_ptr);
RLBOX_UNUSED(sandbox_ptr);
using T_To_C = std_array_to_c_arr_t<T_To>; using T_From_C = std_array_to_c_arr_t<T_From>; using T_To_El = remove_all_extents_t<T_To_C>; using T_From_El = remove_all_extents_t<T_From_C>;
if constexpr (is_pointer_v<T_To_C> || is_pointer_v<T_From_C>) {
if constexpr (Direction == adjust_type_direction::NO_CHANGE) {
static_assert(is_pointer_v<T_To_C> && is_pointer_v<T_From_C> && sizeof(T_To_C) == sizeof(T_From_C));
to = from;
// Structs implement their own convert_type by specializing this class // Have to do this via a class, as functions can't be partially specialized template<typename T_Sbx,
adjust_type_direction Direction,
adjust_type_context Context, typename T_To, typename T_From> class convert_type_class; // The specialization implements the following // { // static inline void run(T_To& to, // const T_From& from, // const void* example_unsandboxed_ptr); // }
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.