mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-15 19:24:33 +00:00
[ADT] Add a 'find_as' operation to DenseSet.
This operation is analogous to its counterpart in DenseMap: It allows lookup via cheap-to-construct keys (provided that getHashValue and isEqual are implemented for the cheap key-type in the DenseMapInfo specialization). Thanks to Chandler for the review. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220168 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -110,6 +110,21 @@ public:
|
||||
const_iterator end() const { return ConstIterator(TheMap.end()); }
|
||||
|
||||
iterator find(const ValueT &V) { return Iterator(TheMap.find(V)); }
|
||||
|
||||
/// Alternative version of find() which allows a different, and possibly less
|
||||
/// expensive, key type.
|
||||
/// The DenseMapInfo is responsible for supplying methods
|
||||
/// getHashValue(LookupKeyT) and isEqual(LookupKeyT, KeyT) for each key type
|
||||
/// used.
|
||||
template <class LookupKeyT>
|
||||
iterator find_as(const LookupKeyT &Val) {
|
||||
return Iterator(TheMap.find_as(Val));
|
||||
}
|
||||
template <class LookupKeyT>
|
||||
const_iterator find_as(const LookupKeyT &Val) const {
|
||||
return ConstIterator(TheMap.find_as(Val));
|
||||
}
|
||||
|
||||
void erase(Iterator I) { return TheMap.erase(I.I); }
|
||||
void erase(ConstIterator CI) { return TheMap.erase(CI.I); }
|
||||
|
||||
|
Reference in New Issue
Block a user