mirror of
https://github.com/BlackMATov/meta.hpp.git
synced 2025-12-14 03:29:28 +07:00
move destructor auto bind to class_bind ctor
This commit is contained in:
@@ -62,5 +62,5 @@ TEST_CASE("meta/meta_examples/inplace") {
|
||||
CHECK(ivec2_length2(ivec2_ptr) == 13);
|
||||
|
||||
// you must manually call the object's destructor
|
||||
ivec2_type.destroy_at(ivec2_buffer.get_memory());
|
||||
CHECK(ivec2_type.destroy_at(ivec2_buffer.get_memory()));
|
||||
}
|
||||
|
||||
@@ -3655,13 +3655,7 @@ namespace meta_hpp
|
||||
|
||||
template < detail::class_kind Class >
|
||||
class_bind<Class> class_(metadata_map metadata = {}) {
|
||||
class_bind<Class> bind{std::move(metadata)};
|
||||
|
||||
if constexpr ( std::is_destructible_v<Class> ) {
|
||||
bind.destructor_();
|
||||
}
|
||||
|
||||
return bind;
|
||||
return class_bind<Class>{std::move(metadata)};
|
||||
}
|
||||
|
||||
template < detail::enum_kind Enum >
|
||||
@@ -3812,6 +3806,10 @@ namespace meta_hpp
|
||||
: data_{detail::type_access(resolve_type<Class>())} {
|
||||
data_->metadata.swap(metadata);
|
||||
data_->metadata.merge(metadata);
|
||||
|
||||
if constexpr ( std::is_destructible_v<Class> ) {
|
||||
destructor_();
|
||||
}
|
||||
}
|
||||
|
||||
template < detail::class_kind Class >
|
||||
|
||||
@@ -419,13 +419,7 @@ namespace meta_hpp
|
||||
|
||||
template < detail::class_kind Class >
|
||||
class_bind<Class> class_(metadata_map metadata = {}) {
|
||||
class_bind<Class> bind{std::move(metadata)};
|
||||
|
||||
if constexpr ( std::is_destructible_v<Class> ) {
|
||||
bind.destructor_();
|
||||
}
|
||||
|
||||
return bind;
|
||||
return class_bind<Class>{std::move(metadata)};
|
||||
}
|
||||
|
||||
template < detail::enum_kind Enum >
|
||||
|
||||
@@ -17,6 +17,10 @@ namespace meta_hpp
|
||||
: data_{detail::type_access(resolve_type<Class>())} {
|
||||
data_->metadata.swap(metadata);
|
||||
data_->metadata.merge(metadata);
|
||||
|
||||
if constexpr ( std::is_destructible_v<Class> ) {
|
||||
destructor_();
|
||||
}
|
||||
}
|
||||
|
||||
template < detail::class_kind Class >
|
||||
|
||||
Reference in New Issue
Block a user