From 34de35dd3107d23486cba898940b4beb53d15fdd Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Sat, 24 Jan 2026 17:55:57 +0800 Subject: [PATCH] fix: fix XContainer --- LibCmo/LibCmo/XContainer/XTypes.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/LibCmo/LibCmo/XContainer/XTypes.cpp b/LibCmo/LibCmo/XContainer/XTypes.cpp index 3ffb658..5986fab 100644 --- a/LibCmo/LibCmo/XContainer/XTypes.cpp +++ b/LibCmo/LibCmo/XContainer/XTypes.cpp @@ -40,11 +40,11 @@ namespace LibCmo::XContainer { ba[n] = false; } - template + template static bool GeneralGetBitPosition(const XBitArray& ba, CKDWORD n, CKDWORD& got) { CKDWORD counter = 0; for (size_t i = 0; i < ba.size(); ++i) { - if (ba[i] == _Cond) { + if (ba[i] == BCondition) { if (counter == n) { got = static_cast(i); return true; @@ -81,18 +81,14 @@ namespace LibCmo::XContainer { } - template - static constexpr bool GeneralXArrayCheck_TypeCheck() { - return std::is_same_v<_Ty, CK2::CK_ID> || std::is_same_v<_Ty, CK2::ObjImpls::CKObject*>; - } - template - static bool GeneralXArrayCheck_ItemCheck(const _Ty& item, CK2::CKContext* ctx) { - static_assert(GeneralXArrayCheck_TypeCheck<_Ty>()); + template + requires (std::is_same_v || std::is_same_v) + static bool GeneralXArrayCheck_ItemCheck(const T& item, CK2::CKContext* ctx) { if (ctx == nullptr) return false; - if constexpr (_IsPre) { + if constexpr (BIsPre) { CK2::ObjImpls::CKObject* obj = nullptr; - if constexpr (std::is_same_v<_Ty, CK2::CK_ID>) { + if constexpr (std::is_same_v) { obj = ctx->GetObject(item); if (obj == nullptr) return false; } else { @@ -101,7 +97,7 @@ namespace LibCmo::XContainer { if (obj->IsToBeDeleted()) return false; } else { CK2::MgrImpls::CKObjectManager* objmgr = ctx->GetObjectManager(); - if constexpr (std::is_same_v<_Ty, CK2::CK_ID>) { + if constexpr (std::is_same_v) { if (!objmgr->IsObjectSafe(item)) return false; } else { if (!objmgr->IsObjectPointerSafe(item)) return false;