meta: use a shared_pointer to void for meta properties

This commit is contained in:
Michele Caini
2022-09-06 11:25:10 +02:00
parent 0068afa06c
commit a30cecdf36
3 changed files with 4 additions and 3 deletions

View File

@@ -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;
}

View File

@@ -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{};
}
/**

View File

@@ -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 {