|
|
@@ -192,11 +192,22 @@ bool compare(const void *lhs, const void *rhs) {
|
|
|
|
|
|
|
|
|
struct ENTT_API meta_context {
|
|
|
- inline static meta_type_node *local = nullptr;
|
|
|
- inline static meta_type_node **global = &local;
|
|
|
+ // we could use the lines below but VS2017 returns with an ICE if combined with ENTT_API despite the code being valid C++
|
|
|
+ // inline static meta_type_node *local = nullptr;
|
|
|
+ // inline static meta_type_node **global = &local;
|
|
|
+
|
|
|
+ static meta_type_node * & local() ENTT_NOEXCEPT {
|
|
|
+ static meta_type_node *chain = nullptr;
|
|
|
+ return chain;
|
|
|
+ }
|
|
|
+
|
|
|
+ static meta_type_node ** & global() ENTT_NOEXCEPT {
|
|
|
+ static meta_type_node **chain = &local();
|
|
|
+ return chain;
|
|
|
+ }
|
|
|
|
|
|
static void detach(const meta_type_node *node) ENTT_NOEXCEPT {
|
|
|
- auto **it = global;
|
|
|
+ auto **it = global();
|
|
|
|
|
|
while(*it && *it != node) {
|
|
|
it = &(*it)->next;
|
|
|
@@ -261,11 +272,11 @@ struct meta_ctx {
|
|
|
* @param other A valid context to which to bind.
|
|
|
*/
|
|
|
static void bind(meta_ctx other) ENTT_NOEXCEPT {
|
|
|
- internal::meta_context::global = other.ctx;
|
|
|
+ internal::meta_context::global() = other.ctx;
|
|
|
}
|
|
|
|
|
|
private:
|
|
|
- internal::meta_type_node **ctx{&internal::meta_context::local};
|
|
|
+ internal::meta_type_node **ctx{&internal::meta_context::local()};
|
|
|
};
|
|
|
|
|
|
|