From 309291452711de03b3051fa2ded14dcaff4099ba Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Wed, 18 Sep 2019 15:40:13 +0300 Subject: [PATCH] typeindices.hpp: add typeindex() helper --- Utilities/typemap.h | 2 +- rpcs3/util/fixed_typemap.hpp | 4 ++-- rpcs3/util/typeindices.hpp | 7 +++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Utilities/typemap.h b/Utilities/typemap.h index a725138c27..4a2edeb296 100644 --- a/Utilities/typemap.h +++ b/Utilities/typemap.h @@ -506,7 +506,7 @@ namespace utils template typemap_head* get_head() const { - return &m_map[stx::type_counter::type>.index()]; + return &m_map[stx::typeindex>()]; } public: diff --git a/rpcs3/util/fixed_typemap.hpp b/rpcs3/util/fixed_typemap.hpp index 81739fbf1f..01c8526111 100644 --- a/rpcs3/util/fixed_typemap.hpp +++ b/rpcs3/util/fixed_typemap.hpp @@ -96,7 +96,7 @@ namespace stx template As* init(Args&&... args) noexcept { - auto& ptr = m_list[stx::type_counter::template type>.index()]; + auto& ptr = m_list[stx::typeindex>()]; if (ptr) { @@ -112,7 +112,7 @@ namespace stx template T* get() const noexcept { - return static_cast(m_list[stx::type_counter::template type>.index()]); + return static_cast(m_list[stx::typeindex>()]); } }; } diff --git a/rpcs3/util/typeindices.hpp b/rpcs3/util/typeindices.hpp index f8ae73dec2..1e2443d306 100644 --- a/rpcs3/util/typeindices.hpp +++ b/rpcs3/util/typeindices.hpp @@ -123,4 +123,11 @@ namespace stx typelist_v.next->next = this; typelist_v.next = this; } + + // Type index accessor + template + inline unsigned typeindex() noexcept + { + return type_counter::template type.index(); + } }