|
|
@@ -389,6 +389,12 @@ public:
|
|
|
*/
|
|
|
[[nodiscard]] inline meta_type type() const noexcept;
|
|
|
|
|
|
+ /**
|
|
|
+ * @brief Sets a meta type for the contained instance.
|
|
|
+ * @param alias The meta to use with the contained instance.
|
|
|
+ */
|
|
|
+ inline void type(const meta_type &alias) noexcept;
|
|
|
+
|
|
|
/**
|
|
|
* @brief Invokes the underlying function, if possible.
|
|
|
* @param id Unique identifier.
|
|
|
@@ -1009,6 +1015,8 @@ struct meta_base: meta_object<internal::meta_base_node> {
|
|
|
|
|
|
/*! @brief Opaque wrapper for types. */
|
|
|
class meta_type {
|
|
|
+ friend class meta_any;
|
|
|
+
|
|
|
[[nodiscard]] const auto &fetch_node() const {
|
|
|
return (node == nullptr) ? internal::resolve<void>(internal::meta_context::from(*ctx)) : *node;
|
|
|
}
|
|
|
@@ -1470,6 +1478,12 @@ private:
|
|
|
return *this ? meta_type{*ctx, fetch_node()} : meta_type{};
|
|
|
}
|
|
|
|
|
|
+inline void meta_any::type(const meta_type &alias) noexcept {
|
|
|
+ ENTT_ASSERT(type().info() == alias.info(), "Unexpected type");
|
|
|
+ node = alias.node;
|
|
|
+ ctx = alias.ctx;
|
|
|
+}
|
|
|
+
|
|
|
// NOLINTNEXTLINE(modernize-use-nodiscard)
|
|
|
meta_any meta_any::invoke(const id_type id, auto &&...args) const {
|
|
|
return type().invoke(id, *this, stl::forward<decltype(args)>(args)...);
|