Replace template conditionals with C++20 requires clause

Related: https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-constraints.html

PR #19424.
This commit is contained in:
Chocobo1 2023-08-09 20:33:19 +08:00 committed by GitHub
parent 33d767b765
commit 5c06d0aa75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 31 deletions

View file

@ -47,14 +47,14 @@ public:
private slots:
void testHasMappedType() const
{
QVERIFY(static_cast<bool>(Algorithm::HasMappedType<std::map<bool, bool>>::value));
QVERIFY(static_cast<bool>(Algorithm::HasMappedType<std::unordered_map<bool, bool>>::value));
QVERIFY(static_cast<bool>(Algorithm::HasMappedType<QHash<bool, bool>>::value));
QVERIFY(static_cast<bool>(Algorithm::HasMappedType<QMap<bool, bool>>::value));
static_assert(Algorithm::HasMappedType<std::map<bool, bool>>);
static_assert(Algorithm::HasMappedType<std::unordered_map<bool, bool>>);
static_assert(Algorithm::HasMappedType<QHash<bool, bool>>);
static_assert(Algorithm::HasMappedType<QMap<bool, bool>>);
QVERIFY(!static_cast<bool>(Algorithm::HasMappedType<std::set<bool>>::value));
QVERIFY(!static_cast<bool>(Algorithm::HasMappedType<std::unordered_set<bool>>::value));
QVERIFY(!static_cast<bool>(Algorithm::HasMappedType<QSet<bool>>::value));
static_assert(!Algorithm::HasMappedType<std::set<bool>>);
static_assert(!Algorithm::HasMappedType<std::unordered_set<bool>>);
static_assert(!Algorithm::HasMappedType<QSet<bool>>);
}
void testMappedTypeRemoveIf() const