meta: use a shared_pointer to void for meta properties
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
@@ -82,7 +83,7 @@ public:
|
||||
|
||||
node->details->prop[key] = internal::meta_prop_node{
|
||||
&internal::resolve<std::decay_t<Value>>...,
|
||||
std::forward<Value>(value)...};
|
||||
std::make_shared<std::decay_t<Value>>(std::forward<Value>(value))...};
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -669,7 +669,7 @@ struct meta_prop {
|
||||
* @return A wrapper containing the value stored with the property.
|
||||
*/
|
||||
[[nodiscard]] meta_any value() const {
|
||||
return (node && node->type) ? node->type()->from_void(nullptr, node->value.data()) : meta_any{};
|
||||
return (node && node->type) ? node->type()->from_void(nullptr, node->value.get()) : meta_any{};
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -49,7 +49,7 @@ struct meta_type_node;
|
||||
|
||||
struct meta_prop_node {
|
||||
meta_type_node *(*type)() noexcept {};
|
||||
basic_any<0u> value{};
|
||||
std::shared_ptr<void> value{};
|
||||
};
|
||||
|
||||
struct meta_base_node {
|
||||
|
||||
Reference in New Issue
Block a user