14 #ifndef LLVM_ADT_DENSESET_H
15 #define LLVM_ADT_DENSESET_H
38 template<
typename ValueT,
typename ValueInfoT = DenseMapInfo<ValueT> >
43 "DenseMap buckets unexpectedly large!");
50 explicit DenseSet(
unsigned NumInitBuckets = 0) : TheMap(NumInitBuckets) {}
66 return TheMap.
count(V);
70 return TheMap.
erase(V);
74 TheMap.
swap(RHS.TheMap);
135 template <
class LookupKeyT>
137 return Iterator(TheMap.
find_as(Val));
139 template <
class LookupKeyT>
141 return ConstIterator(TheMap.
find_as(Val));
147 std::pair<iterator, bool>
insert(
const ValueT &V) {
149 return TheMap.
insert(std::make_pair(V, Empty));
153 template<
typename InputIt>
bool operator!=(const Iterator &X) const
std::forward_iterator_tag iterator_category
MapTy::iterator::difference_type difference_type
Iterator(const typename MapTy::iterator &i)
const DenseSetEmpty & getSecond() const
DenseSet - This implements a dense probed hash-table based set.
ConstIterator(const typename MapTy::const_iterator &i)
const ValueT & operator*()
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
size_t getMemorySize() const
Return the approximate size (in bytes) of the actual map.
bool erase(const ValueT &V)
size_t getMemorySize() const
ConstIterator const_iterator
ConstIterator & operator++()
DenseSetEmpty & getSecond()
bool operator!=(const ConstIterator &X) const
bool erase(const KeyT &Val)
std::forward_iterator_tag iterator_category
iterator find(const ValueT &V)
size_type count(const ValueT &V) const
Return 1 if the specified key is in the set, 0 otherwise.
const_iterator find_as(const LookupKeyT &Val) const
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang","erlang-compatible garbage collector")
const_iterator end() const
const ValueT * operator->()
DenseMapIterator< ValueT, detail::DenseSetEmpty, ValueInfoT, detail::DenseSetPair< ValueT >, true > const_iterator
void resize(size_type Size)
Grow the densemap so that it has at least Size buckets. Does not shrink.
void erase(ConstIterator CI)
void insert(InputIt I, InputIt E)
DenseSet(unsigned NumInitBuckets=0)
std::pair< iterator, bool > insert(const ValueT &V)
const KeyT & getFirst() const
DenseMapIterator< ValueT, detail::DenseSetEmpty, ValueInfoT, detail::DenseSetPair< ValueT > > iterator
bool operator==(const ConstIterator &X) const
size_type count(const KeyT &Val) const
Return 1 if the specified key is in the map, 0 otherwise.
iterator find_as(const LookupKeyT &Val)
Alternative version of find() which allows a different, and possibly less expensive, key type.
void resize(size_t Size)
Grow the DenseSet so that it has at least Size buckets.
const_iterator begin() const
MapTy::const_iterator::difference_type difference_type
iterator find(const KeyT &Val)
bool operator==(const Iterator &X) const
iterator find_as(const LookupKeyT &Val)
Alternate version of find() which allows a different, and possibly less expensive, key type.
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
ptrdiff_t difference_type