|
|
@@ -318,7 +318,7 @@ class meta_any {
|
|
|
|
|
|
template<typename Type>
|
|
|
static Type * release(Type *instance) {
|
|
|
- auto * const node = internal::meta_info<Type>::resolve();
|
|
|
+ const auto * const node = internal::meta_info<Type>::resolve();
|
|
|
[[maybe_unused]] const bool destroyed = (!node->dtor || node->dtor->invoke(*instance));
|
|
|
ENTT_ASSERT(destroyed);
|
|
|
return instance;
|
|
|
@@ -1748,6 +1748,43 @@ private:
|
|
|
};
|
|
|
|
|
|
|
|
|
+/*! @brief Opaque container for a meta context. */
|
|
|
+class meta_ctx {
|
|
|
+ auto ctx() const ENTT_NOEXCEPT {
|
|
|
+ return &internal::meta_info<>::local;
|
|
|
+ }
|
|
|
+
|
|
|
+public:
|
|
|
+ /*! @brief Default constructor. */
|
|
|
+ meta_ctx() ENTT_NOEXCEPT = default;
|
|
|
+
|
|
|
+ /*! @brief Default copy constructor, deleted on purpose. */
|
|
|
+ meta_ctx(const meta_ctx &) = delete;
|
|
|
+ /*! @brief Default move constructor, deleted on purpose. */
|
|
|
+ meta_ctx(meta_ctx &&) = delete;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @brief Copy assignment operator.
|
|
|
+ * @param other The instance to copy from.
|
|
|
+ * @return This meta object.
|
|
|
+ */
|
|
|
+ meta_ctx & operator=(const meta_ctx &other) {
|
|
|
+ internal::meta_info<>::ctx = other.ctx();
|
|
|
+ return *this;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @brief Move assignment operator.
|
|
|
+ * @param other The instance to move from.
|
|
|
+ * @return This meta object.
|
|
|
+ */
|
|
|
+ meta_ctx & operator=(meta_ctx &&other) {
|
|
|
+ internal::meta_info<>::ctx = other.ctx();
|
|
|
+ return *this;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
/*! @copydoc operator!=(const meta_prop &, const meta_prop &) */
|
|
|
inline bool operator!=(const meta_type &lhs, const meta_type &rhs) ENTT_NOEXCEPT {
|
|
|
return !(lhs == rhs);
|