From 9d1df1dae44f40de26587ff8a7a49b2be4e1e5f0 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Sun, 9 Oct 2022 12:00:28 +0200 Subject: [PATCH] meta: make from_void forward the context to the returned element --- src/entt/meta/node.hpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/entt/meta/node.hpp b/src/entt/meta/node.hpp index ae553d87a..b5df0d3b7 100644 --- a/src/entt/meta/node.hpp +++ b/src/entt/meta/node.hpp @@ -207,12 +207,11 @@ template } if constexpr(!std::is_same_v && !std::is_function_v) { - node.from_void = +[](void *element, const void *as_const, const meta_ctx &ctx_TODO) { - if(element) { - return meta_any{std::in_place_type &>, *static_cast *>(element)}; - } - - return meta_any{std::in_place_type &>, *static_cast *>(as_const)}; + node.from_void = +[](void *element, const void *as_const, const meta_ctx &ctx) { + // TODO it would be great if we had value and context construction support for meta_any + meta_any elem{ctx}; + element ? elem.emplace &>(*static_cast *>(element)) : elem.emplace &>(*static_cast *>(as_const)); + return elem; }; }