14 #ifndef LLVM_ADT_DENSESET_H 15 #define LLVM_ADT_DENSESET_H 23 #include <initializer_list> 54 template <
typename ValueT,
typename MapTy,
typename ValueInfoT>
56 static_assert(
sizeof(
typename MapTy::value_type) ==
sizeof(
ValueT),
57 "DenseMap buckets unexpectedly large!");
68 explicit DenseSetImpl(
unsigned InitialReserve = 0) : TheMap(InitialReserve) {}
72 insert(Elems.begin(), Elems.end());
75 bool empty()
const {
return TheMap.empty(); }
93 return TheMap.count(V);
97 return TheMap.erase(V);
107 typename MapTy::iterator
I;
119 Iterator(
const typename MapTy::iterator &i) : I(i) {}
133 typename MapTy::const_iterator
I;
166 iterator find(const_arg_type_t<ValueT> V) {
return Iterator(TheMap.find(V)); }
168 return ConstIterator(TheMap.find(V));
176 template <
class LookupKeyT>
178 return Iterator(TheMap.find_as(Val));
180 template <
class LookupKeyT>
182 return ConstIterator(TheMap.find_as(Val));
185 void erase(Iterator
I) {
return TheMap.erase(I.I); }
186 void erase(ConstIterator CI) {
return TheMap.erase(CI.I); }
190 return TheMap.try_emplace(V, Empty);
195 return TheMap.try_emplace(std::move(V), Empty);
200 template <
typename LookupKeyT>
202 const LookupKeyT &LookupKey) {
205 template <
typename LookupKeyT>
211 template<
typename InputIt>
224 template <
typename ValueT,
typename MapTy,
typename ValueInfoT>
240 template <
typename ValueT,
typename MapTy,
typename ValueInfoT>
243 return !(LHS == RHS);
249 template <
typename ValueT,
typename ValueInfoT = DenseMapInfo<ValueT>>
251 ValueT, DenseMap<ValueT, detail::DenseSetEmpty, ValueInfoT,
252 detail::DenseSetPair<ValueT>>,
266 template <
typename ValueT,
unsigned InlineBuckets = 4,
270 ValueT, SmallDenseMap<ValueT, detail::DenseSetEmpty, InlineBuckets,
271 ValueInfoT, detail::DenseSetPair<ValueT>>,
284 #endif // LLVM_ADT_DENSESET_H
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
bool operator!=(const ConstIterator &X) const
This class represents lattice values for constants.
const KeyT & getFirst() const
Implements a dense probed hash-table based set.
ConstIterator & operator++()
bool erase(const ValueT &V)
ConstIterator operator++(int)
std::pair< iterator, bool > insert_as(ValueT &&V, const LookupKeyT &LookupKey)
bool operator!=(const DenseSetImpl< ValueT, MapTy, ValueInfoT > &LHS, const DenseSetImpl< ValueT, MapTy, ValueInfoT > &RHS)
Inequality comparison for DenseSet.
bool operator==(const ConstIterator &X) const
bool operator==(const ConstIterator &X) const
ConstIterator const_iterator
DenseSetEmpty & getSecond()
Iterator(const typename MapTy::iterator &i)
bool operator==(const DenseSetImpl< ValueT, MapTy, ValueInfoT > &LHS, const DenseSetImpl< ValueT, MapTy, ValueInfoT > &RHS)
Equality comparison for DenseSet.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
std::pair< iterator, bool > insert_as(const ValueT &V, const LookupKeyT &LookupKey)
Alternative version of insert that uses a different (and possibly less expensive) key type...
bool operator!=(const ConstIterator &X) const
const ValueT & operator*() const
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
std::pair< iterator, bool > insert(const ValueT &V)
const_iterator begin() const
iterator find_as(const LookupKeyT &Val)
Alternative version of find() which allows a different, and possibly less expensive, key type.
std::pair< iterator, bool > insert(ValueT &&V)
void insert(InputIt I, InputIt E)
std::forward_iterator_tag iterator_category
void swap(DenseSetImpl &RHS)
DenseSetImpl(std::initializer_list< ValueT > Elems)
DenseSetImpl(unsigned InitialReserve=0)
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
Implements a dense probed hash-table based set with some number of buckets stored inline...
typename MapTy::const_iterator::difference_type difference_type
const ValueT * operator->() const
void erase(ConstIterator CI)
void resize(size_t Size)
Grow the DenseSet so that it has at least Size buckets.
ConstIterator(const typename MapTy::const_iterator &i)
iterator find(const_arg_type_t< ValueT > V)
void reserve(size_t Size)
Grow the DenseSet so that it can contain at least NumEntries items before resizing again...
size_type count(const_arg_type_t< ValueT > V) const
Return 1 if the specified key is in the set, 0 otherwise.
const ValueT & operator*() const
const ValueT * operator->() const
ConstIterator(const Iterator &B)
std::forward_iterator_tag iterator_category
typename MapTy::iterator::difference_type difference_type
const_iterator find_as(const LookupKeyT &Val) const
const_iterator find(const_arg_type_t< ValueT > V) const
size_t getMemorySize() const
const DenseSetEmpty & getSecond() const
const_iterator end() const
uint64_t PowerOf2Ceil(uint64_t A)
Returns the power of two which is greater than or equal to the given value.
Base class for DenseSet and DenseSmallSet.