Browse Source

meta_any: cleanup

Michele Caini 1 year ago
parent
commit
b480d8bc14
2 changed files with 3 additions and 3 deletions
  1. 0 1
      TODO
  2. 3 2
      src/entt/meta/meta.hpp

+ 0 - 1
TODO

@@ -44,4 +44,3 @@ TODO:
 * built-in no-pagination storage - no_pagination page size as limits::max
 * meta_any ownership construction and from_void
 * sparse_set shrink_to_fit argument for sparse array shrink policy (none, empty, deep, whatever)
-* meta_any: avoid initializing members with global context an void vtable

+ 3 - 2
src/entt/meta/meta.hpp

@@ -218,7 +218,8 @@ class meta_any {
 
 public:
     /*! Default constructor. */
-    meta_any() = default;
+    meta_any()
+        : meta_any{meta_ctx_arg, locator<meta_ctx>::value_or()} {}
 
     /**
      * @brief Context aware constructor.
@@ -639,7 +640,7 @@ public:
 
 private:
     any storage{};
-    const meta_ctx *ctx{&locator<meta_ctx>::value_or()};
+    const meta_ctx *ctx{};
     internal::meta_type_node node{};
     vtable_type *vtable{};
 };