[llvm-branch-commits] [llvm] [ADT] Use perfect forwarding in SmallSet::insert() (PR #108590)
Jakub Kuderski via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Sep 13 09:22:13 PDT 2024
================
@@ -231,6 +215,31 @@ class SmallSet {
private:
bool isSmall() const { return Set.empty(); }
+
+ template <typename ArgType>
+ std::pair<const_iterator, bool> insertImpl(ArgType &&V) {
+ static_assert(std::is_convertible_v<ArgType, T>,
+ "ArgType must be convertible to T!");
+ if (!isSmall()) {
+ auto [I, Inserted] = Set.insert(std::forward<ArgType>(V));
+ return std::make_pair(const_iterator(I), Inserted);
----------------
kuhar wrote:
```suggestion
return {const_iterator(I), Inserted};
```
https://github.com/llvm/llvm-project/pull/108590
More information about the llvm-branch-commits
mailing list