meta: context aware meta_prop_node

This commit is contained in:
Michele Caini
2022-10-05 12:09:10 +02:00
parent 6a8a9c4b31
commit 9c969fb6ac
3 changed files with 8 additions and 4 deletions

View File

@@ -11,6 +11,7 @@
#include "../core/fwd.hpp"
#include "../core/type_info.hpp"
#include "../core/type_traits.hpp"
#include "../locator/locator.hpp" // TODO
#include "context.hpp"
#include "meta.hpp"
#include "node.hpp"
@@ -489,13 +490,13 @@ public:
*bucket,
id,
internal::meta_prop_node{
&internal::resolve_TODO<void>});
&internal::resolve<void>});
} else {
internal::meta_extend(
*bucket,
id,
internal::meta_prop_node{
&internal::resolve_TODO<std::decay_t<Value>>...,
&internal::resolve<std::decay_t<Value>>...,
std::make_shared<std::decay_t<Value>>(std::forward<Value>(value))...});
}

View File

@@ -13,6 +13,7 @@
#include "../core/type_info.hpp"
#include "../core/type_traits.hpp"
#include "../core/utility.hpp"
#include "../locator/locator.hpp" // TODO
#include "adl_pointer.hpp"
#include "context.hpp"
#include "fwd.hpp"
@@ -655,7 +656,8 @@ struct meta_prop {
* @return A wrapper containing the value stored with the property.
*/
[[nodiscard]] meta_any value() const {
return node->value ? node->type().from_void(nullptr, node->value.get()) : meta_any{};
const auto &ctx_TODO = internal::meta_context::from(locator<meta_ctx>::value_or());
return node->value ? node->type(ctx_TODO).from_void(nullptr, node->value.get()) : meta_any{};
}
/**

View File

@@ -13,6 +13,7 @@
#include "../core/type_info.hpp"
#include "../core/type_traits.hpp"
#include "../core/utility.hpp"
#include "../locator/locator.hpp" // TODO
#include "context.hpp"
#include "type_traits.hpp"
@@ -48,7 +49,7 @@ enum class meta_traits : std::uint32_t {
struct meta_type_node;
struct meta_prop_node {
meta_type_node (*type)() noexcept {};
meta_type_node (*type)(const meta_context &) noexcept {};
std::shared_ptr<void> value{};
};