14#ifndef LLVM_ADT_SMALLSET_H
15#define LLVM_ADT_SMALLSET_H
22#include <initializer_list>
30template <
typename T,
unsigned N,
typename C>
33 std::forward_iterator_tag, T> {
35 using SetIterTy =
typename std::set<T, C>::const_iterator;
86 IsSmall =
Other.IsSmall;
100 IsSmall =
Other.IsSmall;
109 if (IsSmall !=
RHS.IsSmall)
131template <
typename T,
unsigned N,
typename C = std::less<T>>
142 static_assert(
N <= 32,
"N should be small");
158 template <
typename RangeT>
160 insert(R.begin(), R.end());
168 [[nodiscard]]
bool empty()
const {
return Vector.empty() && Set.empty(); }
171 return isSmall() ?
Vector.size() : Set.size();
181 std::pair<const_iterator, bool>
insert(
const T &V) {
return insertImpl(V); }
183 std::pair<const_iterator, bool>
insert(
T &&V) {
184 return insertImpl(std::move(V));
187 template <
typename IterT>
212 return {Set.begin()};
224 return vfind(V) !=
Vector.end();
225 return Set.find(V) != Set.end();
229 bool isSmall()
const {
return Set.empty(); }
231 template <
typename ArgType>
232 std::pair<const_iterator, bool> insertImpl(ArgType &&V) {
233 static_assert(std::is_convertible_v<ArgType, T>,
234 "ArgType must be convertible to T!");
236 auto [
I, Inserted] = Set.insert(std::forward<ArgType>(V));
244 Vector.push_back(std::forward<ArgType>(V));
248 Set.insert(std::make_move_iterator(
Vector.begin()),
249 std::make_move_iterator(
Vector.end()));
256 typename SmallVector<T, N>::const_iterator vfind(
const T &V)
const {
266template <
typename Po
inteeType,
unsigned N>
277template <
typename T,
unsigned LN,
unsigned RN,
typename C>
279 if (
LHS.size() !=
RHS.size())
289template <
typename T,
unsigned LN,
unsigned RN,
typename C>
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
SmallSetIterator - This class implements a const_iterator for SmallSet by delegating to the underlyin...
SmallSetIterator & operator=(SmallSetIterator &&Other)
SmallSetIterator & operator++()
bool operator==(const SmallSetIterator &RHS) const
SmallSetIterator(SetIterTy SetIter)
SmallSetIterator & operator=(const SmallSetIterator &Other)
SmallSetIterator(const SmallSetIterator &Other)
const T & operator*() const
SmallSetIterator(VecIterTy VecIter)
SmallSetIterator(SmallSetIterator &&Other)
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
SmallSet(const iterator_range< RangeT > &R)
const_iterator begin() const
size_type count(const T &V) const
count - Return 1 if the element is in the set, 0 otherwise.
SmallSetIterator< T, N, C > const_iterator
void insert(IterT I, IterT E)
std::pair< const_iterator, bool > insert(T &&V)
SmallSet(std::initializer_list< T > L)
SmallSet & operator=(const SmallSet &)=default
SmallSet(SmallSet &&)=default
SmallSet(const SmallSet &)=default
const_iterator end() const
SmallSet(IterT Begin, IterT End)
bool contains(const T &V) const
Check if the SmallSet contains the given element.
SmallSet & operator=(SmallSet &&)=default
std::pair< const_iterator, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
A range adaptor for a pair of iterators.
This is an optimization pass for GlobalISel generic memory operations.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
bool operator!=(uint64_t V1, const APInt &V2)
bool operator==(const AddressRangeValuePair &LHS, const AddressRangeValuePair &RHS)