aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/ADT/DenseSet.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/ADT/DenseSet.h')
-rw-r--r--include/llvm/ADT/DenseSet.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/llvm/ADT/DenseSet.h b/include/llvm/ADT/DenseSet.h
index ef09dce37980..3724a09623f3 100644
--- a/include/llvm/ADT/DenseSet.h
+++ b/include/llvm/ADT/DenseSet.h
@@ -94,6 +94,7 @@ public:
ValueT *operator->() { return &I->getFirst(); }
Iterator& operator++() { ++I; return *this; }
+ Iterator operator++(int) { auto T = *this; ++I; return T; }
bool operator==(const Iterator& X) const { return I == X.I; }
bool operator!=(const Iterator& X) const { return I != X.I; }
};
@@ -115,6 +116,7 @@ public:
const ValueT *operator->() { return &I->getFirst(); }
ConstIterator& operator++() { ++I; return *this; }
+ ConstIterator operator++(int) { auto T = *this; ++I; return T; }
bool operator==(const ConstIterator& X) const { return I == X.I; }
bool operator!=(const ConstIterator& X) const { return I != X.I; }
};
@@ -152,6 +154,19 @@ public:
return TheMap.insert(std::make_pair(V, Empty));
}
+ /// Alternative version of insert that uses a different (and possibly less
+ /// expensive) key type.
+ template <typename LookupKeyT>
+ std::pair<iterator, bool> insert_as(const ValueT &V,
+ const LookupKeyT &LookupKey) {
+ return insert_as(ValueT(V), LookupKey);
+ }
+ template <typename LookupKeyT>
+ std::pair<iterator, bool> insert_as(ValueT &&V, const LookupKeyT &LookupKey) {
+ detail::DenseSetEmpty Empty;
+ return TheMap.insert_as(std::make_pair(std::move(V), Empty), LookupKey);
+ }
+
// Range insertion of values.
template<typename InputIt>
void insert(InputIt I, InputIt E) {