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