summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/TextureCacheBase.cpp
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/TextureCacheBase.cpp
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/TextureCacheBase.cpp')
-rw-r--r--Source/Core/VideoCommon/TextureCacheBase.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp
index f58460e9ad..dc47eac86e 100644
--- a/Source/Core/VideoCommon/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/TextureCacheBase.cpp
@@ -652,8 +652,8 @@ void TextureCacheBase::DoSaveState(PointerWrap& p)
auto refpair1 = std::make_pair(*id1, *id2);
auto refpair2 = std::make_pair(*id2, *id1);
- if (!reference_pairs.contains(refpair1) && !reference_pairs.contains(refpair2))
- reference_pairs.insert(refpair1);
+ if (!reference_pairs.contains(refpair2))
+ reference_pairs.insert(std::move(refpair1));
}
}