Merge pull request #13012 from mitaclaw/Use-contains-method-2
Use contains method 2
This commit is contained in:
commit
d10c3aaf29
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -515,7 +515,7 @@ void NetPlayClient::OnPlayerLeave(sf::Packet& packet)
|
|||
const auto& player = it->second;
|
||||
INFO_LOG_FMT(NETPLAY, "Player {} ({}) left", player.name, pid);
|
||||
m_dialog->OnPlayerDisconnect(player.name);
|
||||
m_players.erase(m_players.find(pid));
|
||||
m_players.erase(it);
|
||||
}
|
||||
|
||||
m_dialog->Update();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -102,7 +102,7 @@ protected:
|
|||
|
||||
for (auto remove_prefix : {"BTN_", "KEY_"})
|
||||
{
|
||||
if (name.find(remove_prefix) == 0)
|
||||
if (name.starts_with(remove_prefix))
|
||||
return std::string(name.substr(std::strlen(remove_prefix)));
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue