[PATCH] D131549: [ADT] Make SmallSet::insert(const T &) returns const_iterator
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 10 10:29:44 PDT 2022
dblaikie added a comment.
Sounds OK, with a minor improvement using structured bindings.
================
Comment at: llvm/include/llvm/ADT/SmallSet.h:182-184
+ SIterator SIt;
+ bool Inserted;
+ std::tie(SIt, Inserted) = Set.insert(V);
----------------
Could use a structure binding here?
================
Comment at: llvm/include/llvm/ADT/SmallSet.h:188
- VIterator I = vfind(V);
- if (I != Vector.end()) // Don't reinsert if it already exists.
- return std::make_pair(None, false);
+ VIterator VIt = vfind(V);
+ if (VIt != Vector.end()) // Don't reinsert if it already exists.
----------------
Not sure the iterators need to be renamed - they're in distinct scopes and it'd probably be OK for them both to be named `I` despite them having different types.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131549/new/
https://reviews.llvm.org/D131549
More information about the llvm-commits
mailing list