Merge pull request #122 from BlackMATov/dev

Dev
This commit is contained in:
2025-03-14 21:28:52 +07:00
committed by GitHub
2 changed files with 2 additions and 2 deletions

View File

@@ -9765,7 +9765,7 @@ namespace meta_hpp::detail::class_type_data_impl
template < class_kind Class, class_kind Target >
void add_upcast_info(new_base_info_t& info) {
const class_type_data::upcast_func_t::upcast_t class_to_target = []() {
if constexpr ( requires { static_cast<Target*>(std::declval<Class*>()); } ) {
if constexpr ( std::is_base_of_v<Target, Class> && std::is_convertible_v<Class*, Target*> ) {
return +[](void* from) -> void* { //
return static_cast<Target*>(static_cast<Class*>(from));
};

View File

@@ -30,7 +30,7 @@ namespace meta_hpp::detail::class_type_data_impl
template < class_kind Class, class_kind Target >
void add_upcast_info(new_base_info_t& info) {
const class_type_data::upcast_func_t::upcast_t class_to_target = []() {
if constexpr ( requires { static_cast<Target*>(std::declval<Class*>()); } ) {
if constexpr ( std::is_base_of_v<Target, Class> && std::is_convertible_v<Class*, Target*> ) {
return +[](void* from) -> void* { //
return static_cast<Target*>(static_cast<Class*>(from));
};