diff --git a/src/entt/meta/meta.hpp b/src/entt/meta/meta.hpp index be5015bda..f9910f703 100644 --- a/src/entt/meta/meta.hpp +++ b/src/entt/meta/meta.hpp @@ -216,8 +216,19 @@ public: */ template explicit meta_any(std::in_place_type_t, Args &&...args) + : meta_any{locator::value_or(), std::in_place_type, std::forward(args)...} {} + + /** + * @brief Constructs a wrapper by directly initializing the new object. + * @tparam Type Type of object to use to initialize the wrapper. + * @tparam Args Types of arguments to use to construct the new instance. + * @param area The context from which to search for meta types. + * @param args Parameters to use to construct the instance. + */ + template + explicit meta_any(const meta_ctx &area, std::in_place_type_t, Args &&...args) : storage{std::in_place_type, std::forward(args)...}, - ctx{&locator::value_or()}, + ctx{&area}, node{internal::resolve>>(internal::meta_context::from(*ctx))}, vtable{&basic_vtable>>} {} @@ -228,7 +239,17 @@ public: */ template, meta_any>>> meta_any(Type &&value) - : meta_any{std::in_place_type>, std::forward(value)} {} + : meta_any{locator::value_or(), std::forward(value)} {} + + /** + * @brief Constructs a wrapper from a given value. + * @tparam Type Type of object to use to initialize the wrapper. + * @param area The context from which to search for meta types. + * @param value An instance of an object to use to initialize the wrapper. + */ + template, meta_any>>> + meta_any(const meta_ctx &area, Type &&value) + : meta_any{area, std::in_place_type>, std::forward(value)} {} /** * @brief Copy constructor.