diff --git a/src/rttr/detail/variant/variant_data_policy.h b/src/rttr/detail/variant/variant_data_policy.h index 8eeaafbe..b7b4d1fd 100644 --- a/src/rttr/detail/variant/variant_data_policy.h +++ b/src/rttr/detail/variant/variant_data_policy.h @@ -516,7 +516,16 @@ struct variant_data_policy_array_big : variant_data_base_policy(dest) = new T; + if constexpr (std::is_bounded_array_v) + { + constexpr size_t size = std::extent_v; + using Type = std::remove_extent_t; + reinterpret_cast(dest) = new Type[size]; + } + else + { + reinterpret_cast(dest) = new T; + } COPY_ARRAY_PRE_PROC(value, dest); } @@ -530,7 +539,16 @@ struct variant_data_policy_array_big : variant_data_base_policy(dest) = new T; + if constexpr (std::is_bounded_array_v) + { + constexpr size_t size = std::extent_v; + using Type = std::remove_extent_t; + reinterpret_cast(dest) = new Type[size]; + } + else + { + reinterpret_cast(dest) = new T; + } COPY_ARRAY_PRE_PROC(value, dest); }