summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/GraphicsModSystem/Runtime
diff options
context:
space:
mode:
authorSintendo <3380580+Sintendo@users.noreply.github.com>2025-07-06 08:41:12 +0200
committerSintendo <3380580+Sintendo@users.noreply.github.com>2025-07-08 06:53:42 +0200
commitf2392e4048ce977bad2227d08f3a042526f7c4da (patch)
tree1ff5cd55011aa8503f504eefc57e49a7c35985a8 /Source/Core/VideoCommon/GraphicsModSystem/Runtime
parenta5e85caf0af66fec07b476718a69519b06e6a69f (diff)
Avoid map/set double lookups
Fix some common anti-patterns with these data structures. - You can dereference the iterator returned by `find` to access the underlying value directly, without an extra `operator[]`/`at`. - Rather than checking for an element before insertion/deletion, you can just do the operation and if needed check the return value to determine if the insertion/deletion succeeded.
Diffstat (limited to 'Source/Core/VideoCommon/GraphicsModSystem/Runtime')
-rw-r--r--Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.cpp b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.cpp
index 0d070a4310..70d3a9a5ca 100644
--- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.cpp
+++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.cpp
@@ -197,14 +197,13 @@ void GraphicsModManager::Load(const GraphicsModGroupConfig& config)
{
for (const GraphicsTargetGroupConfig& group : mod.m_groups)
{
- if (m_groups.contains(group.m_name))
+ if (const bool inserted = m_groups.insert(group.m_name).second; !inserted)
{
WARN_LOG_FMT(
VIDEO,
"Specified graphics mod group '{}' for mod '{}' is already specified by another mod.",
group.m_name, mod.m_title);
}
- m_groups.insert(group.m_name);
const auto internal_group = fmt::format("{}.{}", mod.m_title, group.m_name);
for (const GraphicsTargetConfig& target : group.m_targets)