Use 'contains' method

This commit is contained in:
mitaclaw 2024-08-15 14:20:16 -07:00
parent 18ac8bf405
commit 9fa4eb9aab
9 changed files with 12 additions and 14 deletions

View File

@ -53,7 +53,7 @@ Java_org_dolphinemu_dolphinemu_features_cheats_model_GraphicsModGroup_getMods(JN
// If no group matches the mod's features, or if the mod has no features, skip it
if (std::none_of(mod.m_features.begin(), mod.m_features.end(),
[&groups](const GraphicsModFeatureConfig& feature) {
return groups.count(feature.m_group) == 1;
return groups.contains(feature.m_group);
}))
{
continue;

View File

@ -73,7 +73,7 @@ EventType* CoreTimingManager::RegisterEvent(const std::string& name, TimedCallba
{
// check for existing type with same name.
// we want event type names to remain unique so that we can use them for serialization.
ASSERT_MSG(POWERPC, m_event_types.find(name) == m_event_types.end(),
ASSERT_MSG(POWERPC, !m_event_types.contains(name),
"CoreTiming Event \"{}\" is already registered. Events should only be registered "
"during Init to avoid breaking save states.",
name);

View File

@ -1101,8 +1101,7 @@ bool JitArm64::DoJit(u32 em_address, JitBlock* b, u32 nextPC)
if (IsProfilingEnabled())
ABI_CallFunction(&JitBlock::ProfileData::BeginProfiling, b->profile_data.get());
if (code_block.m_gqr_used.Count() == 1 &&
js.pairedQuantizeAddresses.find(js.blockStart) == js.pairedQuantizeAddresses.end())
if (code_block.m_gqr_used.Count() == 1 && !js.pairedQuantizeAddresses.contains(js.blockStart))
{
int gqr = *code_block.m_gqr_used.begin();
if (!code_block.m_gqr_modified[gqr] && !GQR(m_ppc_state, gqr))
@ -1126,8 +1125,7 @@ bool JitArm64::DoJit(u32 em_address, JitBlock* b, u32 nextPC)
gpr.Start(js.gpa);
fpr.Start(js.fpa);
if (js.noSpeculativeConstantsAddresses.find(js.blockStart) ==
js.noSpeculativeConstantsAddresses.end())
if (!js.noSpeculativeConstantsAddresses.contains(js.blockStart))
{
IntializeSpeculativeConstants();
}

View File

@ -143,7 +143,7 @@ void GameConfigEdit::OnSelectionChanged()
{
const QString& keyword = m_edit->textCursor().selectedText();
if (m_keyword_map.count(keyword))
if (m_keyword_map.contains(keyword))
QWhatsThis::showText(QCursor::pos(), m_keyword_map[keyword], this);
}

View File

@ -140,7 +140,7 @@ void GraphicsModListWidget::RefreshModList()
// If no group matches the mod's features, or if the mod has no features, skip it
if (std::none_of(mod.m_features.begin(), mod.m_features.end(),
[&groups](const GraphicsModFeatureConfig& feature) {
return groups.count(feature.m_group) == 1;
return groups.contains(feature.m_group);
}))
{
continue;

View File

@ -179,7 +179,7 @@ std::string KeycodeToName(const CGKeyCode keycode)
{kVK_RightOption, "Right Alt"},
};
if (named_keys.find(keycode) != named_keys.end())
if (named_keys.contains(keycode))
return named_keys.at(keycode);
else
return "Key " + std::to_string(keycode);

View File

@ -290,7 +290,7 @@ void ShaderCache::LoadPipelineCache(T& cache, Common::LinearDiskCache<DiskKeyTyp
UnserializePipelineUid(key, real_uid);
// Skip those which are already compiled.
if (failed || cache.find(real_uid) != cache.end())
if (failed || cache.contains(real_uid))
return;
auto config = this_ptr->GetGXPipelineConfig(real_uid);

View File

@ -19,13 +19,13 @@ TEST(UniqueID, UniqueEnough)
for (u32 i = 0x0C000000; i < 0x0C010000; ++i)
{
u32 unique_id = MMIO::UniqueID(i);
EXPECT_EQ(ids.end(), ids.find(unique_id));
EXPECT_FALSE(ids.contains(unique_id));
ids.insert(unique_id);
}
for (u32 i = 0x0D000000; i < 0x0D010000; ++i)
{
u32 unique_id = MMIO::UniqueID(i);
EXPECT_EQ(ids.end(), ids.find(unique_id));
EXPECT_FALSE(ids.contains(unique_id));
ids.insert(unique_id);
}
}

View File

@ -28,13 +28,13 @@ TEST(VertexLoaderUID, UniqueEnough)
vtx_desc.low.Hex = 0x76543210;
vtx_desc.high.Hex = 0xFEDCBA98;
EXPECT_EQ(uids.end(), uids.find(VertexLoaderUID(vtx_desc, vat)));
EXPECT_FALSE(uids.contains(VertexLoaderUID(vtx_desc, vat)));
uids.insert(VertexLoaderUID(vtx_desc, vat));
vat.g0.Hex = 0xFFFFFFFF;
vat.g1.Hex = 0xFFFFFFFF;
vat.g2.Hex = 0xFFFFFFFF;
EXPECT_EQ(uids.end(), uids.find(VertexLoaderUID(vtx_desc, vat)));
EXPECT_FALSE(uids.contains(VertexLoaderUID(vtx_desc, vat)));
uids.insert(VertexLoaderUID(vtx_desc, vat));
}