WPILibC++ 2024.3.2
SmallPtrSet.h
Go to the documentation of this file.
1//===- llvm/ADT/SmallPtrSet.h - 'Normally small' pointer set ----*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8///
9/// \file
10/// This file defines the SmallPtrSet class. See the doxygen comment for
11/// SmallPtrSetImplBase for more details on the algorithm used.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef WPIUTIL_WPI_SMALLPTRSET_H
16#define WPIUTIL_WPI_SMALLPTRSET_H
17
18#include "wpi/EpochTracker.h"
19#include "wpi/Compiler.h"
21#include "wpi/type_traits.h"
22#include <cassert>
23#include <cstddef>
24#include <cstdlib>
25#include <cstring>
26#include <initializer_list>
27#include <iterator>
28#include <utility>
29
30namespace wpi {
31
32/// SmallPtrSetImplBase - This is the common code shared among all the
33/// SmallPtrSet<>'s, which is almost everything. SmallPtrSet has two modes, one
34/// for small and one for large sets.
35///
36/// Small sets use an array of pointers allocated in the SmallPtrSet object,
37/// which is treated as a simple array of pointers. When a pointer is added to
38/// the set, the array is scanned to see if the element already exists, if not
39/// the element is 'pushed back' onto the array. If we run out of space in the
40/// array, we grow into the 'large set' case. SmallSet should be used when the
41/// sets are often small. In this case, no memory allocation is used, and only
42/// light-weight and cache-efficient scanning is used.
43///
44/// Large sets use a classic exponentially-probed hash table. Empty buckets are
45/// represented with an illegal pointer value (-1) to allow null pointers to be
46/// inserted. Tombstones are represented with another illegal pointer value
47/// (-2), to allow deletion. The hash table is resized when the table is 3/4 or
48/// more. When this happens, the table is doubled in size.
49///
52
53protected:
54 /// SmallArray - Points to a fixed size set of buckets, used in 'small mode'.
55 const void **SmallArray;
56 /// CurArray - This is the current set of buckets. If equal to SmallArray,
57 /// then the set is in 'small mode'.
58 const void **CurArray;
59 /// CurArraySize - The allocated size of CurArray, always a power of two.
60 unsigned CurArraySize;
61
62 /// Number of elements in CurArray that contain a value or are a tombstone.
63 /// If small, all these elements are at the beginning of CurArray and the rest
64 /// is uninitialized.
65 unsigned NumNonEmpty;
66 /// Number of tombstones in CurArray.
67 unsigned NumTombstones;
68
69 // Helpers to copy and move construct a SmallPtrSet.
70 SmallPtrSetImplBase(const void **SmallStorage,
71 const SmallPtrSetImplBase &that);
72 SmallPtrSetImplBase(const void **SmallStorage, unsigned SmallSize,
73 SmallPtrSetImplBase &&that);
74
75 explicit SmallPtrSetImplBase(const void **SmallStorage, unsigned SmallSize)
76 : SmallArray(SmallStorage), CurArray(SmallStorage),
77 CurArraySize(SmallSize), NumNonEmpty(0), NumTombstones(0) {
78 assert(SmallSize && (SmallSize & (SmallSize-1)) == 0 &&
79 "Initial size must be a power of two!");
80 }
81
83 if (!isSmall())
85 }
86
87public:
88 using size_type = unsigned;
89
91
92 [[nodiscard]] bool empty() const { return size() == 0; }
94
95 void clear() {
97 // If the capacity of the array is huge, and the # elements used is small,
98 // shrink the array.
99 if (!isSmall()) {
100 if (size() * 4 < CurArraySize && CurArraySize > 32)
101 return shrink_and_clear();
102 // Fill the array with empty markers.
103 memset(CurArray, -1, CurArraySize * sizeof(void *));
104 }
105
106 NumNonEmpty = 0;
107 NumTombstones = 0;
108 }
109
110protected:
111 static void *getTombstoneMarker() { return reinterpret_cast<void*>(-2); }
112
113 static void *getEmptyMarker() {
114 // Note that -1 is chosen to make clear() efficiently implementable with
115 // memset and because it's not a valid pointer value.
116 return reinterpret_cast<void*>(-1);
117 }
118
119 const void **EndPointer() const {
120 return isSmall() ? CurArray + NumNonEmpty : CurArray + CurArraySize;
121 }
122
123 /// insert_imp - This returns true if the pointer was new to the set, false if
124 /// it was already in the set. This is hidden from the client so that the
125 /// derived class can check that the right type of pointer is passed in.
126 std::pair<const void *const *, bool> insert_imp(const void *Ptr) {
127 if (isSmall()) {
128 // Check to see if it is already in the set.
129 const void **LastTombstone = nullptr;
130 for (const void **APtr = SmallArray, **E = SmallArray + NumNonEmpty;
131 APtr != E; ++APtr) {
132 const void *Value = *APtr;
133 if (Value == Ptr)
134 return std::make_pair(APtr, false);
135 if (Value == getTombstoneMarker())
136 LastTombstone = APtr;
137 }
138
139 // Did we find any tombstone marker?
140 if (LastTombstone != nullptr) {
141 *LastTombstone = Ptr;
144 return std::make_pair(LastTombstone, true);
145 }
146
147 // Nope, there isn't. If we stay small, just 'pushback' now.
149 SmallArray[NumNonEmpty++] = Ptr;
151 return std::make_pair(SmallArray + (NumNonEmpty - 1), true);
152 }
153 // Otherwise, hit the big set case, which will call grow.
154 }
155 return insert_imp_big(Ptr);
156 }
157
158 /// erase_imp - If the set contains the specified pointer, remove it and
159 /// return true, otherwise return false. This is hidden from the client so
160 /// that the derived class can check that the right type of pointer is passed
161 /// in.
162 bool erase_imp(const void * Ptr) {
163 const void *const *P = find_imp(Ptr);
164 if (P == EndPointer())
165 return false;
166
167 const void **Loc = const_cast<const void **>(P);
168 assert(*Loc == Ptr && "broken find!");
169 *Loc = getTombstoneMarker();
171 return true;
172 }
173
174 /// Returns the raw pointer needed to construct an iterator. If element not
175 /// found, this will be EndPointer. Otherwise, it will be a pointer to the
176 /// slot which stores Ptr;
177 const void *const * find_imp(const void * Ptr) const {
178 if (isSmall()) {
179 // Linear search for the item.
180 for (const void *const *APtr = SmallArray,
181 *const *E = SmallArray + NumNonEmpty; APtr != E; ++APtr)
182 if (*APtr == Ptr)
183 return APtr;
184 return EndPointer();
185 }
186
187 // Big set case.
188 auto *Bucket = FindBucketFor(Ptr);
189 if (*Bucket == Ptr)
190 return Bucket;
191 return EndPointer();
192 }
193
194private:
195 bool isSmall() const { return CurArray == SmallArray; }
196
197 std::pair<const void *const *, bool> insert_imp_big(const void *Ptr);
198
199 const void * const *FindBucketFor(const void *Ptr) const;
200 void shrink_and_clear();
201
202 /// Grow - Allocate a larger backing store for the buckets and move it over.
203 void Grow(unsigned NewSize);
204
205protected:
206 /// swap - Swaps the elements of two sets.
207 /// Note: This method assumes that both sets have the same small size.
209
211 void MoveFrom(unsigned SmallSize, SmallPtrSetImplBase &&RHS);
212
213private:
214 /// Code shared by MoveFrom() and move constructor.
215 void MoveHelper(unsigned SmallSize, SmallPtrSetImplBase &&RHS);
216 /// Code shared by CopyFrom() and copy constructor.
217 void CopyHelper(const SmallPtrSetImplBase &RHS);
218};
219
220/// SmallPtrSetIteratorImpl - This is the common base class shared between all
221/// instances of SmallPtrSetIterator.
223protected:
224 const void *const *Bucket;
225 const void *const *End;
226
227public:
228 explicit SmallPtrSetIteratorImpl(const void *const *BP, const void*const *E)
229 : Bucket(BP), End(E) {
230 if (shouldReverseIterate()) {
232 return;
233 }
235 }
236
237 bool operator==(const SmallPtrSetIteratorImpl &RHS) const {
238 return Bucket == RHS.Bucket;
239 }
240 bool operator!=(const SmallPtrSetIteratorImpl &RHS) const {
241 return Bucket != RHS.Bucket;
242 }
243
244protected:
245 /// AdvanceIfNotValid - If the current bucket isn't valid, advance to a bucket
246 /// that is. This is guaranteed to stop because the end() bucket is marked
247 /// valid.
249 assert(Bucket <= End);
250 while (Bucket != End &&
253 ++Bucket;
254 }
256 assert(Bucket >= End);
257 while (Bucket != End &&
260 --Bucket;
261 }
262 }
263};
264
265/// SmallPtrSetIterator - This implements a const_iterator for SmallPtrSet.
266template <typename PtrTy>
271
272public:
273 using value_type = PtrTy;
274 using reference = PtrTy;
275 using pointer = PtrTy;
276 using difference_type = std::ptrdiff_t;
277 using iterator_category = std::forward_iterator_tag;
278
279 explicit SmallPtrSetIterator(const void *const *BP, const void *const *E,
280 const DebugEpochBase &Epoch)
281 : SmallPtrSetIteratorImpl(BP, E), DebugEpochBase::HandleBase(&Epoch) {}
282
283 // Most methods are provided by the base class.
284
285 const PtrTy operator*() const {
286 assert(isHandleInSync() && "invalid iterator access!");
287 if (shouldReverseIterate()) {
288 assert(Bucket > End);
289 return PtrTraits::getFromVoidPointer(const_cast<void *>(Bucket[-1]));
290 }
291 assert(Bucket < End);
292 return PtrTraits::getFromVoidPointer(const_cast<void*>(*Bucket));
293 }
294
295 inline SmallPtrSetIterator& operator++() { // Preincrement
296 assert(isHandleInSync() && "invalid iterator access!");
297 if (shouldReverseIterate()) {
298 --Bucket;
299 RetreatIfNotValid();
300 return *this;
301 }
302 ++Bucket;
303 AdvanceIfNotValid();
304 return *this;
305 }
306
307 SmallPtrSetIterator operator++(int) { // Postincrement
308 SmallPtrSetIterator tmp = *this;
309 ++*this;
310 return tmp;
311 }
312};
313
314/// RoundUpToPowerOfTwo - This is a helper template that rounds N up to the next
315/// power of two (which means N itself if N is already a power of two).
316template<unsigned N>
317struct RoundUpToPowerOfTwo;
318
319/// RoundUpToPowerOfTwoH - If N is not a power of two, increase it. This is a
320/// helper template used to implement RoundUpToPowerOfTwo.
321template<unsigned N, bool isPowerTwo>
323 enum { Val = N };
324};
325template<unsigned N>
326struct RoundUpToPowerOfTwoH<N, false> {
327 enum {
328 // We could just use NextVal = N+1, but this converges faster. N|(N-1) sets
329 // the right-most zero bits to one all at once, e.g. 0b0011000 -> 0b0011111.
330 Val = RoundUpToPowerOfTwo<(N|(N-1)) + 1>::Val
331 };
332};
333
334template<unsigned N>
336 enum { Val = RoundUpToPowerOfTwoH<N, (N&(N-1)) == 0>::Val };
337};
338
339/// A templated base class for \c SmallPtrSet which provides the
340/// typesafe interface that is common across all small sizes.
341///
342/// This is particularly useful for passing around between interface boundaries
343/// to avoid encoding a particular small size in the interface boundary.
344template <typename PtrType>
346 using ConstPtrType = typename add_const_past_pointer<PtrType>::type;
349
350protected:
351 // Forward constructors to the base.
353
354public:
357 using key_type = ConstPtrType;
358 using value_type = PtrType;
359
361
362 /// Inserts Ptr if and only if there is no element in the container equal to
363 /// Ptr. The bool component of the returned pair is true if and only if the
364 /// insertion takes place, and the iterator component of the pair points to
365 /// the element equal to Ptr.
366 std::pair<iterator, bool> insert(PtrType Ptr) {
367 auto p = insert_imp(PtrTraits::getAsVoidPointer(Ptr));
368 return std::make_pair(makeIterator(p.first), p.second);
369 }
370
371 /// Insert the given pointer with an iterator hint that is ignored. This is
372 /// identical to calling insert(Ptr), but allows SmallPtrSet to be used by
373 /// std::insert_iterator and std::inserter().
374 iterator insert(iterator, PtrType Ptr) {
375 return insert(Ptr).first;
376 }
377
378 /// erase - If the set contains the specified pointer, remove it and return
379 /// true, otherwise return false.
380 bool erase(PtrType Ptr) {
381 return erase_imp(PtrTraits::getAsVoidPointer(Ptr));
382 }
383 /// count - Return 1 if the specified pointer is in the set, 0 otherwise.
384 size_type count(ConstPtrType Ptr) const {
385 return find_imp(ConstPtrTraits::getAsVoidPointer(Ptr)) != EndPointer();
386 }
387 iterator find(ConstPtrType Ptr) const {
388 return makeIterator(find_imp(ConstPtrTraits::getAsVoidPointer(Ptr)));
389 }
390 bool contains(ConstPtrType Ptr) const {
391 return find_imp(ConstPtrTraits::getAsVoidPointer(Ptr)) != EndPointer();
392 }
393
394 template <typename IterT>
395 void insert(IterT I, IterT E) {
396 for (; I != E; ++I)
397 insert(*I);
398 }
399
400 void insert(std::initializer_list<PtrType> IL) {
401 insert(IL.begin(), IL.end());
402 }
403
404 iterator begin() const {
406 return makeIterator(EndPointer() - 1);
407 return makeIterator(CurArray);
408 }
409 iterator end() const { return makeIterator(EndPointer()); }
410
411private:
412 /// Create an iterator that dereferences to same place as the given pointer.
413 iterator makeIterator(const void *const *P) const {
415 return iterator(P == EndPointer() ? CurArray : P + 1, CurArray, *this);
416 return iterator(P, EndPointer(), *this);
417 }
418};
419
420/// Equality comparison for SmallPtrSet.
421///
422/// Iterates over elements of LHS confirming that each value from LHS is also in
423/// RHS, and that no additional values are in RHS.
424template <typename PtrType>
426 const SmallPtrSetImpl<PtrType> &RHS) {
427 if (LHS.size() != RHS.size())
428 return false;
429
430 for (const auto *KV : LHS)
431 if (!RHS.count(KV))
432 return false;
433
434 return true;
435}
436
437/// Inequality comparison for SmallPtrSet.
438///
439/// Equivalent to !(LHS == RHS).
440template <typename PtrType>
442 const SmallPtrSetImpl<PtrType> &RHS) {
443 return !(LHS == RHS);
444}
445
446/// SmallPtrSet - This class implements a set which is optimized for holding
447/// SmallSize or less elements. This internally rounds up SmallSize to the next
448/// power of two if it is not already a power of two. See the comments above
449/// SmallPtrSetImplBase for details of the algorithm.
450template<class PtrType, unsigned SmallSize>
451class SmallPtrSet : public SmallPtrSetImpl<PtrType> {
452 // In small mode SmallPtrSet uses linear search for the elements, so it is
453 // not a good idea to choose this value too high. You may consider using a
454 // DenseSet<> instead if you expect many elements in the set.
455 static_assert(SmallSize <= 32, "SmallSize should be small");
456
458
459 // Make sure that SmallSize is a power of two, round up if not.
460 enum { SmallSizePowTwo = RoundUpToPowerOfTwo<SmallSize>::Val };
461 /// SmallStorage - Fixed size storage used in 'small mode'.
462 const void *SmallStorage[SmallSizePowTwo];
463
464public:
465 SmallPtrSet() : BaseT(SmallStorage, SmallSizePowTwo) {}
466 SmallPtrSet(const SmallPtrSet &that) : BaseT(SmallStorage, that) {}
468 : BaseT(SmallStorage, SmallSizePowTwo, std::move(that)) {}
469
470 template<typename It>
471 SmallPtrSet(It I, It E) : BaseT(SmallStorage, SmallSizePowTwo) {
472 this->insert(I, E);
473 }
474
475 SmallPtrSet(std::initializer_list<PtrType> IL)
476 : BaseT(SmallStorage, SmallSizePowTwo) {
477 this->insert(IL.begin(), IL.end());
478 }
479
482 if (&RHS != this)
483 this->CopyFrom(RHS);
484 return *this;
485 }
486
489 if (&RHS != this)
490 this->MoveFrom(SmallSizePowTwo, std::move(RHS));
491 return *this;
492 }
493
495 operator=(std::initializer_list<PtrType> IL) {
496 this->clear();
497 this->insert(IL.begin(), IL.end());
498 return *this;
499 }
500
501 /// swap - Swaps the elements of two sets.
504 }
505};
506
507} // end namespace wpi
508
509namespace std {
510
511 /// Implement std::swap in terms of SmallPtrSet swap.
512 template<class T, unsigned N>
514 LHS.swap(RHS);
515 }
516
517} // end namespace std
518
519#endif // WPIUTIL_WPI_SMALLPTRSET_H
This file defines the DebugEpochBase and DebugEpochBase::HandleBase classes.
#define LLVM_DEBUGEPOCHBASE_HANDLEBASE_EMPTYBASE
Definition: EpochTracker.h:25
and restrictions which apply to each piece of software is included later in this file and or inside of the individual applicable source files The disclaimer of warranty in the WPILib license above applies to all code in and nothing in any of the other licenses gives permission to use the names of FIRST nor the names of the WPILib contributors to endorse or promote products derived from this software The following pieces of software have additional or alternate and or Google Inc All rights reserved Redistribution and use in source and binary with or without are permitted provided that the following conditions are this list of conditions and the following disclaimer *Redistributions in binary form must reproduce the above copyright this list of conditions and the following disclaimer in the documentation and or other materials provided with the distribution *Neither the name of Google Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY OR CONSEQUENTIAL WHETHER IN STRICT OR EVEN IF ADVISED OF THE POSSIBILITY OF SUCH January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation and configuration files Object form shall mean any form resulting from mechanical transformation or translation of a Source including but not limited to compiled object generated and conversions to other media types Work shall mean the work of whether in Source or Object made available under the as indicated by a copyright notice that is included in or attached to the whether in Source or Object that is based or other modifications as a an original work of authorship For the purposes of this Derivative Works shall not include works that remain separable or merely the Work and Derivative Works thereof Contribution shall mean any work of including the original version of the Work and any modifications or additions to that Work or Derivative Works that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner For the purposes of this submitted means any form of or written communication sent to the Licensor or its including but not limited to communication on electronic mailing source code control and issue tracking systems that are managed or on behalf the Licensor for the purpose of discussing and improving the but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as Not a Contribution Contributor shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work Grant of Copyright License Subject to the terms and conditions of this each Contributor hereby grants to You a non no royalty free
Definition: ThirdPartyNotices.txt:151
A base class for iterator classes ("handles") that wish to poll for iterator invalidating modificatio...
Definition: EpochTracker.h:58
A base class for data structure classes wishing to make iterators ("handles") pointing into themselve...
Definition: EpochTracker.h:36
void incrementEpoch()
Calling incrementEpoch invalidates all handles pointing into the calling instance.
Definition: EpochTracker.h:44
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
Definition: SmallPtrSet.h:451
SmallPtrSet< PtrType, SmallSize > & operator=(SmallPtrSet< PtrType, SmallSize > &&RHS)
Definition: SmallPtrSet.h:488
SmallPtrSet(SmallPtrSet &&that)
Definition: SmallPtrSet.h:467
SmallPtrSet(std::initializer_list< PtrType > IL)
Definition: SmallPtrSet.h:475
SmallPtrSet(It I, It E)
Definition: SmallPtrSet.h:471
SmallPtrSet< PtrType, SmallSize > & operator=(const SmallPtrSet< PtrType, SmallSize > &RHS)
Definition: SmallPtrSet.h:481
SmallPtrSet< PtrType, SmallSize > & operator=(std::initializer_list< PtrType > IL)
Definition: SmallPtrSet.h:495
void swap(SmallPtrSet< PtrType, SmallSize > &RHS)
swap - Swaps the elements of two sets.
Definition: SmallPtrSet.h:502
SmallPtrSet(const SmallPtrSet &that)
Definition: SmallPtrSet.h:466
SmallPtrSet()
Definition: SmallPtrSet.h:465
SmallPtrSetImplBase - This is the common code shared among all the SmallPtrSet<>'s,...
Definition: SmallPtrSet.h:50
std::pair< const void *const *, bool > insert_imp(const void *Ptr)
insert_imp - This returns true if the pointer was new to the set, false if it was already in the set.
Definition: SmallPtrSet.h:126
unsigned NumNonEmpty
Number of elements in CurArray that contain a value or are a tombstone.
Definition: SmallPtrSet.h:65
const void ** SmallArray
SmallArray - Points to a fixed size set of buckets, used in 'small mode'.
Definition: SmallPtrSet.h:55
unsigned size_type
Definition: SmallPtrSet.h:88
SmallPtrSetImplBase & operator=(const SmallPtrSetImplBase &)=delete
~SmallPtrSetImplBase()
Definition: SmallPtrSet.h:82
SmallPtrSetImplBase(const void **SmallStorage, const SmallPtrSetImplBase &that)
unsigned CurArraySize
CurArraySize - The allocated size of CurArray, always a power of two.
Definition: SmallPtrSet.h:60
static void * getTombstoneMarker()
Definition: SmallPtrSet.h:111
static void * getEmptyMarker()
Definition: SmallPtrSet.h:113
const void *const * find_imp(const void *Ptr) const
Returns the raw pointer needed to construct an iterator.
Definition: SmallPtrSet.h:177
void swap(SmallPtrSetImplBase &RHS)
swap - Swaps the elements of two sets.
SmallPtrSetImplBase(const void **SmallStorage, unsigned SmallSize)
Definition: SmallPtrSet.h:75
unsigned NumTombstones
Number of tombstones in CurArray.
Definition: SmallPtrSet.h:67
void clear()
Definition: SmallPtrSet.h:95
size_type size() const
Definition: SmallPtrSet.h:93
bool erase_imp(const void *Ptr)
erase_imp - If the set contains the specified pointer, remove it and return true, otherwise return fa...
Definition: SmallPtrSet.h:162
void MoveFrom(unsigned SmallSize, SmallPtrSetImplBase &&RHS)
SmallPtrSetImplBase(const void **SmallStorage, unsigned SmallSize, SmallPtrSetImplBase &&that)
const void ** EndPointer() const
Definition: SmallPtrSet.h:119
void CopyFrom(const SmallPtrSetImplBase &RHS)
bool empty() const
Definition: SmallPtrSet.h:92
const void ** CurArray
CurArray - This is the current set of buckets.
Definition: SmallPtrSet.h:58
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
Definition: SmallPtrSet.h:345
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
Definition: SmallPtrSet.h:366
SmallPtrSetIterator< PtrType > iterator
Definition: SmallPtrSet.h:355
bool erase(PtrType Ptr)
erase - If the set contains the specified pointer, remove it and return true, otherwise return false.
Definition: SmallPtrSet.h:380
iterator find(ConstPtrType Ptr) const
Definition: SmallPtrSet.h:387
void insert(std::initializer_list< PtrType > IL)
Definition: SmallPtrSet.h:400
iterator end() const
Definition: SmallPtrSet.h:409
ConstPtrType key_type
Definition: SmallPtrSet.h:357
bool contains(ConstPtrType Ptr) const
Definition: SmallPtrSet.h:390
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
Definition: SmallPtrSet.h:384
iterator begin() const
Definition: SmallPtrSet.h:404
iterator insert(iterator, PtrType Ptr)
Insert the given pointer with an iterator hint that is ignored.
Definition: SmallPtrSet.h:374
PtrType value_type
Definition: SmallPtrSet.h:358
void insert(IterT I, IterT E)
Definition: SmallPtrSet.h:395
SmallPtrSetImpl(const SmallPtrSetImpl &)=delete
SmallPtrSetIterator - This implements a const_iterator for SmallPtrSet.
Definition: SmallPtrSet.h:269
PtrTy value_type
Definition: SmallPtrSet.h:273
std::ptrdiff_t difference_type
Definition: SmallPtrSet.h:276
SmallPtrSetIterator(const void *const *BP, const void *const *E, const DebugEpochBase &Epoch)
Definition: SmallPtrSet.h:279
PtrTy pointer
Definition: SmallPtrSet.h:275
std::forward_iterator_tag iterator_category
Definition: SmallPtrSet.h:277
PtrTy reference
Definition: SmallPtrSet.h:274
SmallPtrSetIterator & operator++()
Definition: SmallPtrSet.h:295
const PtrTy operator*() const
Definition: SmallPtrSet.h:285
SmallPtrSetIterator operator++(int)
Definition: SmallPtrSet.h:307
SmallPtrSetIteratorImpl - This is the common base class shared between all instances of SmallPtrSetIt...
Definition: SmallPtrSet.h:222
bool operator!=(const SmallPtrSetIteratorImpl &RHS) const
Definition: SmallPtrSet.h:240
void AdvanceIfNotValid()
AdvanceIfNotValid - If the current bucket isn't valid, advance to a bucket that is.
Definition: SmallPtrSet.h:248
const void *const * Bucket
Definition: SmallPtrSet.h:224
const void *const * End
Definition: SmallPtrSet.h:225
bool operator==(const SmallPtrSetIteratorImpl &RHS) const
Definition: SmallPtrSet.h:237
SmallPtrSetIteratorImpl(const void *const *BP, const void *const *E)
Definition: SmallPtrSet.h:228
void RetreatIfNotValid()
Definition: SmallPtrSet.h:255
Definition: array.h:89
WPI_BASIC_JSON_TPL_DECLARATION void swap(wpi::WPI_BASIC_JSON_TPL &j1, wpi::WPI_BASIC_JSON_TPL &j2) noexcept(//NOLINT(readability-inconsistent-declaration-parameter-name) is_nothrow_move_constructible< wpi::WPI_BASIC_JSON_TPL >::value &&//NOLINT(misc-redundant-expression) is_nothrow_move_assignable< wpi::WPI_BASIC_JSON_TPL >::value)
exchanges the values of two JSON objects
Definition: json.h:5219
Definition: ntcore_cpp.h:26
constexpr bool operator==(const unexpected< E > &lhs, const unexpected< E > &rhs)
Definition: expected:176
constexpr bool operator!=(const unexpected< E > &lhs, const unexpected< E > &rhs)
Definition: expected:180
bool shouldReverseIterate()
Definition: ReverseIteration.h:9
A traits type that is used to handle pointer types and things that are just wrappers for pointers as ...
Definition: PointerLikeTypeTraits.h:25
RoundUpToPowerOfTwoH - If N is not a power of two, increase it.
Definition: SmallPtrSet.h:322
@ Val
Definition: SmallPtrSet.h:323
RoundUpToPowerOfTwo - This is a helper template that rounds N up to the next power of two (which mean...
Definition: SmallPtrSet.h:335
@ Val
Definition: SmallPtrSet.h:336
const T type
Definition: type_traits.h:55