From 8f7703d5c8a0a172f600b23f8f4d03c2e2f34f0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <3397065-ZehMatt@users.noreply.gitlab.com> Date: Thu, 8 Sep 2022 00:13:50 +0300 Subject: [PATCH] Rename HasMember to TupleHasType and move code into misc/meta.hpp --- apps/openmw/mwworld/esmstore.hpp | 11 ++--------- components/misc/meta.hpp | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 components/misc/meta.hpp diff --git a/apps/openmw/mwworld/esmstore.hpp b/apps/openmw/mwworld/esmstore.hpp index 48ba6ec81a..8a7547fb96 100644 --- a/apps/openmw/mwworld/esmstore.hpp +++ b/apps/openmw/mwworld/esmstore.hpp @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -125,20 +126,12 @@ namespace MWWorld // Special entry which is hardcoded and not loaded from an ESM Store>; - template - struct HasMember; - - template - struct HasMember ...>> { - static constexpr bool value = (std::is_same_v || ...); - }; - static std::size_t geNextTypeIndex(); template static std::size_t getTypeIndex() { - static_assert(HasMember::value); + static_assert(Misc::TupleHasType, StoreTuple>::value); static std::size_t sIndex = geNextTypeIndex(); return sIndex; } diff --git a/components/misc/meta.hpp b/components/misc/meta.hpp new file mode 100644 index 0000000000..d0b49476fa --- /dev/null +++ b/components/misc/meta.hpp @@ -0,0 +1,19 @@ +#ifndef OPENMW_COMPONENTS_MISC_META_H +#define OPENMW_COMPONENTS_MISC_META_H + +#include +#include + +namespace Misc +{ + template + struct TupleHasType; + + template + struct TupleHasType> + { + static constexpr bool value = (std::is_same_v || ...); + }; +} + +#endif