14#ifndef WPIUTIL_WPI_SMALLVECTOR_H
15#define WPIUTIL_WPI_SMALLVECTOR_H
22#pragma GCC diagnostic warning "-Wclass-memaccess"
33#include <initializer_list>
46template <
class Iterator>
48 typename std::iterator_traits<Iterator>::iterator_category,
49 std::input_iterator_tag>::value>;
66 return (std::numeric_limits<unsigned>::max)();
71 :
BeginX(FirstEl),
Capacity(static_cast<unsigned>(TotalCapacity)) {}
82 void grow_pod(
void *FirstEl,
size_t MinSize,
size_t TSize);
97 Size =
static_cast<unsigned>(N);
107 Capacity =
static_cast<unsigned>(N);
121template <
typename T,
typename =
void>
131 return const_cast<void *
>(
reinterpret_cast<const void *
>(
132 reinterpret_cast<const char *
>(
this) +
156 std::less<> LessThan;
157 return !LessThan(V, First) && LessThan(V, Last);
169 std::less<> LessThan;
170 return !LessThan(First, this->
begin()) && !LessThan(Last, First) &&
171 !LessThan(this->
end(), Last);
182 if (NewSize <= this->
size())
183 return Elt < this->
begin() + NewSize;
192 "Attempting to reference an element of the vector in an operation "
193 "that invalidates it");
211 std::enable_if_t<!std::is_same<std::remove_const_t<ItTy>, T *>::value,
224 std::enable_if_t<!std::is_same<std::remove_const_t<ItTy>, T *>::value,
233 size_t NewSize = This->size() + N;
237 bool ReferencesStorage =
false;
239 if (!U::TakesParamByValue) {
241 ReferencesStorage =
true;
242 Index = &Elt - This->begin();
246 return ReferencesStorage ? This->begin() + Index : &Elt;
293 assert(idx <
size());
297 assert(idx <
size());
328template <
typename T,
bool = (std::is_trivially_copy_constructible<T>::value) &&
329 (std::is_trivially_move_constructible<T>::value) &&
330 std::is_trivially_destructible<T>::value>
349 template<
typename It1,
typename It2>
351 std::uninitialized_move(I, E, Dest);
356 template<
typename It1,
typename It2>
358 std::uninitialized_copy(I, E, Dest);
386 return const_cast<T *
>(
397 std::uninitialized_fill_n(NewElts, NumElts, Elt);
407 ::new ((
void *)(NewElts + this->
size())) T(std::forward<ArgTypes>(Args)...);
417 ::new ((
void *)this->
end()) T(*EltPtr);
423 ::new ((
void *)this->
end()) T(::std::move(*EltPtr));
434template <
typename T,
bool TriviallyCopyable>
437 T *NewElts = mallocForGrow(MinSize, NewCapacity);
438 moveElementsForGrow(NewElts);
439 takeAllocationForGrow(NewElts, NewCapacity);
442template <
typename T,
bool TriviallyCopyable>
444 size_t MinSize,
size_t &NewCapacity) {
445 return static_cast<T *
>(
447 this->getFirstEl(), MinSize,
sizeof(T), NewCapacity));
451template <
typename T,
bool TriviallyCopyable>
455 this->uninitialized_move(this->begin(), this->end(), NewElts);
458 destroy_range(this->begin(), this->end());
462template <
typename T,
bool TriviallyCopyable>
464 T *NewElts,
size_t NewCapacity) {
466 if (!this->isSmall())
469 this->set_allocation_range(NewElts, NewCapacity);
487 using ValueParamT = std::conditional_t<TakesParamByValue, T, const T &>;
496 template<
typename It1,
typename It2>
504 template<
typename It1,
typename It2>
507 std::uninitialized_copy(I, E, Dest);
512 template <
typename T1,
typename T2>
514 T1 *I, T1 *E, T2 *Dest,
515 std::enable_if_t<std::is_same<std::remove_const_t<T1>, T2>::value> * =
522 memcpy(
reinterpret_cast<void *
>(Dest), I, (E - I) *
sizeof(T));
538 return const_cast<T *
>(
550 std::uninitialized_fill_n(this->
begin(), NumElts, Elt);
558 push_back(T(std::forward<ArgTypes>(Args)...));
565 memcpy(
reinterpret_cast<void *
>(this->
end()), EltPtr,
sizeof(T));
575class SmallVectorImpl :
public SmallVectorTemplateBase<T> {
596 this->
BeginX = RHS.BeginX;
597 this->
Size = RHS.Size;
621 template <
bool ForOverwrite>
void resizeImpl(
size_type N) {
622 if (N == this->
size())
625 if (N < this->
size()) {
631 for (
auto I = this->
end(), E = this->
begin() + N; I != E; ++I)
647 assert(this->
size() >= N &&
"Cannot increase size with truncate");
653 if (N == this->
size())
656 if (N < this->
size()) {
671 assert(this->
size() >= NumItems);
676 T Result = ::std::move(this->
back());
684 template <
typename ItTy,
typename = EnableIfConvertibleToInputIterator<ItTy>>
685 void append(ItTy in_start, ItTy in_end) {
687 size_type NumInputs = std::distance(in_start, in_end);
696 std::uninitialized_fill_n(this->
end(), NumInputs, *EltPtr);
700 void append(std::initializer_list<T> IL) {
701 append(IL.begin(), IL.end());
714 std::fill_n(this->
begin(), (std::min)(NumElts, this->
size()), Elt);
715 if (NumElts > this->
size())
716 std::uninitialized_fill_n(this->
end(), NumElts - this->
size(), Elt);
717 else if (NumElts < this->
size())
725 template <
typename ItTy,
typename = EnableIfConvertibleToInputIterator<ItTy>>
726 void assign(ItTy in_start, ItTy in_end) {
732 void assign(std::initializer_list<T> IL) {
747 std::move(I+1, this->
end(), I);
770 template <
class ArgType>
iterator insert_one_impl(
iterator I, ArgType &&Elt) {
773 std::is_same<std::remove_const_t<std::remove_reference_t<ArgType>>,
775 "ArgType must be derived from T!");
777 if (I == this->
end()) {
778 this->
push_back(::std::forward<ArgType>(Elt));
779 return this->
end()-1;
785 size_t Index = I - this->
begin();
786 std::remove_reference_t<ArgType> *EltPtr =
788 I = this->
begin() + Index;
790 ::new ((
void*) this->
end()) T(::
std::move(this->
back()));
792 std::move_backward(I, this->end()-1, this->end());
798 "ArgType must be 'T' when taking by value!");
802 *I = ::
std::forward<ArgType>(*EltPtr);
817 size_t InsertElt = I - this->
begin();
819 if (I == this->
end()) {
821 return this->
begin()+InsertElt;
831 I = this->
begin()+InsertElt;
837 if (
size_t(this->
end()-I) >= NumToInsert) {
838 T *OldEnd = this->
end();
839 append(std::move_iterator<iterator>(this->
end() - NumToInsert),
840 std::move_iterator<iterator>(this->
end()));
843 std::move_backward(I, OldEnd-NumToInsert, OldEnd);
848 EltPtr += NumToInsert;
850 std::fill_n(I, NumToInsert, *EltPtr);
858 T *OldEnd = this->
end();
860 size_t NumOverwritten = OldEnd-I;
866 EltPtr += NumToInsert;
869 std::fill_n(I, NumOverwritten, *EltPtr);
872 std::uninitialized_fill_n(OldEnd, NumToInsert - NumOverwritten, *EltPtr);
876 template <
typename ItTy,
typename = EnableIfConvertibleToInputIterator<ItTy>>
879 size_t InsertElt = I - this->
begin();
881 if (I == this->
end()) {
883 return this->
begin()+InsertElt;
891 size_t NumToInsert = std::distance(From, To);
897 I = this->
begin()+InsertElt;
903 if (
size_t(this->
end()-I) >= NumToInsert) {
904 T *OldEnd = this->
end();
905 append(std::move_iterator<iterator>(this->
end() - NumToInsert),
906 std::move_iterator<iterator>(this->
end()));
909 std::move_backward(I, OldEnd-NumToInsert, OldEnd);
911 std::copy(From, To, I);
919 T *OldEnd = this->
end();
921 size_t NumOverwritten = OldEnd-I;
925 for (T *J = I; NumOverwritten > 0; --NumOverwritten) {
936 insert(I, IL.begin(), IL.end());
943 ::new ((
void *)this->
end()) T(std::forward<ArgTypes>(Args)...);
953 if (this->
size() != RHS.size())
return false;
954 return std::equal(this->
begin(), this->
end(), RHS.begin());
957 return !(*
this == RHS);
961 return std::lexicographical_compare(this->
begin(), this->
end(),
962 RHS.begin(), RHS.end());
971 if (
this == &RHS)
return;
974 if (!this->
isSmall() && !RHS.isSmall()) {
981 RHS.reserve(this->
size());
984 size_t NumShared = this->
size();
985 if (NumShared > RHS.size()) NumShared = RHS.size();
986 for (
size_type i = 0; i != NumShared; ++i)
990 if (this->
size() > RHS.size()) {
991 size_t EltDiff = this->
size() - RHS.size();
993 RHS.set_size(RHS.size() + EltDiff);
996 }
else if (RHS.size() > this->size()) {
997 size_t EltDiff = RHS.size() - this->
size();
1001 RHS.set_size(NumShared);
1005template <
typename T>
1009 if (
this == &RHS)
return *
this;
1013 size_t RHSSize = RHS.size();
1014 size_t CurSize = this->
size();
1015 if (CurSize >= RHSSize) {
1019 NewEnd = std::copy(RHS.begin(), RHS.begin()+RHSSize, this->begin());
1021 NewEnd = this->
begin();
1038 this->
grow(RHSSize);
1039 }
else if (CurSize) {
1041 std::copy(RHS.begin(), RHS.begin()+CurSize, this->begin());
1046 this->begin()+CurSize);
1053template <
typename T>
1056 if (
this == &RHS)
return *
this;
1059 if (!RHS.isSmall()) {
1066 size_t RHSSize = RHS.
size();
1067 size_t CurSize = this->
size();
1068 if (CurSize >= RHSSize) {
1072 NewEnd = std::move(RHS.begin(), RHS.end(), NewEnd);
1092 this->
grow(RHSSize);
1093 }
else if (CurSize) {
1095 std::move(RHS.begin(), RHS.begin()+CurSize, this->begin());
1100 this->begin()+CurSize);
1111template <
typename T,
unsigned N>
1113 alignas(T)
char InlineElts[N *
sizeof(T)];
1139 static constexpr size_t kPreferredSmallVectorSizeof = 64;
1165 "You are trying to use a default number of inlined elements for "
1166 "`SmallVector<T>` but `sizeof(T)` is really big! Please use an "
1167 "explicit number of inlined elements with `SmallVector<T, N>` to make "
1168 "sure you really want that much inline storage.");
1172 static constexpr size_t PreferredInlineBytes =
1174 static constexpr size_t NumElementsThatFit = PreferredInlineBytes /
sizeof(T);
1175 static constexpr size_t value =
1176 NumElementsThatFit == 0 ? 1 : NumElementsThatFit;
1195template <
typename T,
1204 this->destroy_range(this->begin(), this->end());
1214 this->assign(Size, Value);
1217 template <
typename ItTy,
typename = EnableIfConvertibleToInputIterator<ItTy>>
1222 template <
typename RangeTy>
1232 template <
typename U,
1233 typename = std::enable_if_t<std::is_convertible<U, T>::value>>
1235 this->append(A.begin(), A.end());
1268 this->destroy_range(this->begin(), this->end());
1271 this->assignRemote(std::move(RHS));
1287template <
typename T,
unsigned N>
1292template <
typename RangeType>
1294 std::remove_const_t<std::remove_reference_t<
decltype(*std::begin(
1295 std::declval<RangeType &>()))>>;
1300template <
unsigned Size,
typename R>
1302 return {std::begin(Range), std::end(Range)};
1304template <
typename R>
1306 return {std::begin(Range), std::end(Range)};
1309template <
typename Out,
unsigned Size,
typename R>
1311 return {std::begin(Range), std::end(Range)};
1315 return {std::begin(Range), std::end(Range)};
1318template <
typename T,
typename Pred>
1321 const auto original_size = c.size();
1322 c.erase(std::remove_if(c.begin(), c.end(), pred), c.end());
1323 return original_size - c.size();
1331 template<
typename T>
1338 template<
typename T,
unsigned N>
#define LLVM_UNLIKELY(EXPR)
Definition Compiler.h:332
#define LLVM_GSL_OWNER
LLVM_GSL_OWNER - Apply this to owning classes like SmallVector to enable lifetime warnings.
Definition Compiler.h:428
#define LLVM_LIKELY(EXPR)
Definition Compiler.h:331
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 glfw and nanopb were modified for use in 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:163
This is all the stuff common to all SmallVectors.
Definition SmallVector.h:59
void * mallocForGrow(void *FirstEl, size_t MinSize, size_t TSize, size_t &NewCapacity)
This is a helper for grow() that's out of line to reduce code duplication.
void * BeginX
Definition SmallVector.h:61
size_t size() const
Definition SmallVector.h:85
unsigned Capacity
Definition SmallVector.h:62
unsigned Size
Definition SmallVector.h:62
size_t capacity() const
Definition SmallVector.h:86
static constexpr size_t SizeTypeMax()
The maximum value of the unsigned used.
Definition SmallVector.h:65
void grow_pod(void *FirstEl, size_t MinSize, size_t TSize)
This is an implementation of the grow() method which only works on POD-like data types and is out of ...
SmallVectorBase(void *FirstEl, size_t TotalCapacity)
Definition SmallVector.h:70
bool empty() const
Definition SmallVector.h:88
void set_allocation_range(void *Begin, size_t N)
Set the array data pointer to Begin and capacity to N.
Definition SmallVector.h:104
void set_size(size_t N)
Set the array size to N, which the current array must have enough capacity for.
Definition SmallVector.h:95
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition SmallVector.h:1198
SmallVector(ItTy S, ItTy E)
Definition SmallVector.h:1218
SmallVector(std::span< const U > A)
Definition SmallVector.h:1234
SmallVector(size_t Size, const T &Value)
Definition SmallVector.h:1212
SmallVector(const iterator_range< RangeTy > &R)
Definition SmallVector.h:1223
~SmallVector()
Definition SmallVector.h:1202
SmallVector(std::initializer_list< T > IL)
Definition SmallVector.h:1228
SmallVector(SmallVectorImpl< T > &&RHS)
Definition SmallVector.h:1253
SmallVector & operator=(SmallVectorImpl< T > &&RHS)
Definition SmallVector.h:1276
SmallVector()
Definition SmallVector.h:1200
SmallVector(size_t Size)
Definition SmallVector.h:1207
SmallVector(const SmallVector &RHS)
Definition SmallVector.h:1238
SmallVector & operator=(SmallVector &&RHS)
Definition SmallVector.h:1258
SmallVector & operator=(const SmallVector &RHS)
Definition SmallVector.h:1243
SmallVector(SmallVector &&RHS)
Definition SmallVector.h:1248
SmallVector & operator=(std::initializer_list< T > IL)
Definition SmallVector.h:1281
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition sha1.h:30
bool operator!=(const SmallVectorImpl &RHS) const
Definition SmallVector.h:956
SmallVectorImpl & operator=(SmallVectorImpl &&RHS)
Definition SmallVector.h:1054
iterator erase(const_iterator CI)
Definition SmallVector.h:739
~SmallVectorImpl()
Definition SmallVector.h:602
reference emplace_back(ArgTypes &&... Args)
Definition SmallVector.h:939
void resize_for_overwrite(size_type N)
Like resize, but T is POD, the new values won't be initialized.
Definition SmallVector.h:643
void assign(std::initializer_list< T > IL)
Definition SmallVector.h:732
void append(std::initializer_list< T > IL)
Definition SmallVector.h:700
iterator insert(iterator I, ItTy From, ItTy To)
Definition SmallVector.h:877
bool operator==(const SmallVectorImpl &RHS) const
Definition SmallVector.h:952
T pop_back_val()
Definition SmallVector.h:675
SmallVectorImpl(unsigned N)
Definition SmallVector.h:589
SmallVectorImpl & operator=(const SmallVectorImpl &RHS)
Definition SmallVector.h:1007
bool operator>(const SmallVectorImpl &RHS) const
Definition SmallVector.h:964
void clear()
Definition SmallVector.h:612
void assignRemote(SmallVectorImpl &&RHS)
Definition SmallVector.h:592
bool operator<=(const SmallVectorImpl &RHS) const
Definition SmallVector.h:965
typename SuperClass::size_type size_type
Definition SmallVector.h:582
void swap(SmallVectorImpl &RHS)
Definition SmallVector.h:970
iterator insert(iterator I, T &&Elt)
Definition SmallVector.h:807
void reserve(size_type N)
Definition SmallVector.h:665
void assign(const SmallVectorImpl &RHS)
Definition SmallVector.h:737
void truncate(size_type N)
Like resize, but requires that N is less than size().
Definition SmallVector.h:646
typename SuperClass::iterator iterator
Definition SmallVector.h:579
bool operator<(const SmallVectorImpl &RHS) const
Definition SmallVector.h:960
void assign(size_type NumElts, ValueParamT Elt)
Definition SmallVector.h:706
typename SuperClass::ValueParamT ValueParamT
Definition SmallVector.h:586
typename SuperClass::const_iterator const_iterator
Definition SmallVector.h:580
iterator insert(iterator I, size_type NumToInsert, ValueParamT Elt)
Definition SmallVector.h:815
typename SuperClass::reference reference
Definition SmallVector.h:581
void append(const SmallVectorImpl &RHS)
Definition SmallVector.h:704
SmallVectorImpl(const SmallVectorImpl &)=delete
void resize(size_type N, ValueParamT NV)
Definition SmallVector.h:652
void pop_back_n(size_type NumItems)
Definition SmallVector.h:670
void assign(ItTy in_start, ItTy in_end)
Definition SmallVector.h:726
void insert(iterator I, std::initializer_list< T > IL)
Definition SmallVector.h:935
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
Definition SmallVector.h:685
void append(size_type NumInputs, ValueParamT Elt)
Append NumInputs copies of Elt to the end.
Definition SmallVector.h:694
bool operator>=(const SmallVectorImpl &RHS) const
Definition SmallVector.h:966
void resize(size_type N)
Definition SmallVector.h:640
iterator insert(iterator I, const T &Elt)
Definition SmallVector.h:811
iterator erase(const_iterator CS, const_iterator CE)
Definition SmallVector.h:753
void growAndAssign(size_t NumElts, T Elt)
Definition SmallVector.h:545
std::conditional_t< TakesParamByValue, T, const T & > ValueParamT
Either const T& or T, depending on whether it's cheap enough to take parameters by value.
Definition SmallVector.h:487
const T * reserveForParamAndGetAddress(const T &Elt, size_t N=1)
Reserve enough space to add one element, and return the updated element pointer in case it was a refe...
Definition SmallVector.h:531
static void uninitialized_copy(T1 *I, T1 *E, T2 *Dest, std::enable_if_t< std::is_same< std::remove_const_t< T1 >, T2 >::value > *=nullptr)
Copy the range [I, E) onto the uninitialized memory starting with "Dest", constructing elements into ...
Definition SmallVector.h:513
static ValueParamT forward_value_param(ValueParamT V)
Copy V or return a reference, depending on ValueParamT.
Definition SmallVector.h:543
static void destroy_range(T *, T *)
Definition SmallVector.h:492
SmallVectorTemplateBase(size_t Size)
Definition SmallVector.h:489
T & growAndEmplaceBack(ArgTypes &&... Args)
Definition SmallVector.h:554
void grow(size_t MinSize=0)
Double the size of the allocated memory, guaranteeing space for at least one more element or MinSize ...
Definition SmallVector.h:527
void push_back(ValueParamT Elt)
Definition SmallVector.h:563
static void uninitialized_copy(It1 I, It1 E, It2 Dest)
Copy the range [I, E) onto the uninitialized memory starting with "Dest", constructing elements into ...
Definition SmallVector.h:505
T * reserveForParamAndGetAddress(T &Elt, size_t N=1)
Reserve enough space to add one element, and return the updated element pointer in case it was a refe...
Definition SmallVector.h:537
static void uninitialized_move(It1 I, It1 E, It2 Dest)
Move the range [I, E) onto the uninitialized memory starting with "Dest", constructing elements into ...
Definition SmallVector.h:497
void pop_back()
Definition SmallVector.h:569
SmallVectorTemplateBase<TriviallyCopyable = false> - This is where we put method implementations that...
Definition SmallVector.h:331
static void uninitialized_move(It1 I, It1 E, It2 Dest)
Move the range [I, E) into the uninitialized memory starting with "Dest", constructing elements as ne...
Definition SmallVector.h:350
void moveElementsForGrow(T *NewElts)
Move existing elements over to the new allocation NewElts, the middle section of grow().
Definition SmallVector.h:452
SmallVectorTemplateBase(size_t Size)
Definition SmallVector.h:338
static void uninitialized_copy(It1 I, It1 E, It2 Dest)
Copy the range [I, E) onto the uninitialized memory starting with "Dest", constructing elements as ne...
Definition SmallVector.h:357
T * reserveForParamAndGetAddress(T &Elt, size_t N=1)
Reserve enough space to add one element, and return the updated element pointer in case it was a refe...
Definition SmallVector.h:385
const T & ValueParamT
Definition SmallVector.h:336
void pop_back()
Definition SmallVector.h:427
static const T & forward_value_param(const T &V)
Definition SmallVector.h:391
static void destroy_range(T *S, T *E)
Definition SmallVector.h:340
void takeAllocationForGrow(T *NewElts, size_t NewCapacity)
Transfer ownership of the allocation, finishing up grow().
Definition SmallVector.h:463
static T && forward_value_param(T &&V)
Definition SmallVector.h:390
static constexpr bool TakesParamByValue
Definition SmallVector.h:335
T * mallocForGrow(size_t MinSize, size_t &NewCapacity)
Create a new allocation big enough for MinSize and pass back its size in NewCapacity.
Definition SmallVector.h:443
void push_back(T &&Elt)
Definition SmallVector.h:421
void grow(size_t MinSize=0)
Grow the allocated memory (without initializing new elements), doubling the size of the allocated mem...
Definition SmallVector.h:435
const T * reserveForParamAndGetAddress(const T &Elt, size_t N=1)
Reserve enough space to add one element, and return the updated element pointer in case it was a refe...
Definition SmallVector.h:379
T & growAndEmplaceBack(ArgTypes &&... Args)
Definition SmallVector.h:403
void push_back(const T &Elt)
Definition SmallVector.h:415
void growAndAssign(size_t NumElts, const T &Elt)
Definition SmallVector.h:393
This is the part of SmallVectorTemplateBase which does not depend on whether the type T is a POD.
Definition SmallVector.h:123
ptrdiff_t difference_type
Definition SmallVector.h:251
const T * const_pointer
Definition SmallVector.h:262
void assertSafeToReferenceAfterClear(const T *From, const T *To)
Check whether any part of the range will be invalidated by clearing.
Definition SmallVector.h:203
reverse_iterator rbegin()
Definition SmallVector.h:275
const_iterator begin() const
Definition SmallVector.h:270
reference front()
Definition SmallVector.h:301
size_t size() const
Definition SmallVector.h:85
size_type size_in_bytes() const
Definition SmallVector.h:280
void resetToSmall()
Put this vector in a state of being small.
Definition SmallVector.h:148
void * getFirstEl() const
Find the address of the first element.
Definition SmallVector.h:130
const_reverse_iterator rbegin() const
Definition SmallVector.h:276
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition SmallVector.h:256
const_reference operator[](size_type idx) const
Definition SmallVector.h:296
bool isReferenceToStorage(const void *V) const
Return true if V is an internal reference to this vector.
Definition SmallVector.h:161
const_pointer data() const
Return a pointer to the vector's buffer, even if empty().
Definition SmallVector.h:290
pointer data()
Return a pointer to the vector's buffer, even if empty().
Definition SmallVector.h:288
size_t capacity() const
Definition SmallVector.h:86
iterator begin()
Definition SmallVector.h:269
T * iterator
Definition SmallVector.h:253
const_reference back() const
Definition SmallVector.h:314
const T & const_reference
Definition SmallVector.h:260
size_t size_type
Definition SmallVector.h:250
reference operator[](size_type idx)
Definition SmallVector.h:292
size_t capacity_in_bytes() const
Definition SmallVector.h:285
const_reverse_iterator rend() const
Definition SmallVector.h:278
std::reverse_iterator< iterator > reverse_iterator
Definition SmallVector.h:257
const_iterator end() const
Definition SmallVector.h:272
bool isSmall() const
Return true if this is a smallvector which has not had dynamic memory allocated for it.
Definition SmallVector.h:145
T value_type
Definition SmallVector.h:252
iterator end()
Definition SmallVector.h:271
static const T * reserveForParamAndGetAddressImpl(U *This, const T &Elt, size_t N)
Reserve enough space to add one element, and return the updated element pointer in case it was a refe...
Definition SmallVector.h:231
void assertSafeToAddRange(ItTy, ItTy)
Definition SmallVector.h:226
SmallVectorTemplateCommon(size_t Size)
Definition SmallVector.h:137
void assertSafeToAddRange(const T *From, const T *To)
Check whether any part of the range will be invalidated by growing.
Definition SmallVector.h:216
const_reference front() const
Definition SmallVector.h:305
T & reference
Definition SmallVector.h:259
const T * const_iterator
Definition SmallVector.h:254
T * pointer
Definition SmallVector.h:261
void assertSafeToAdd(const void *Elt, size_t N=1)
Check whether Elt will be invalidated by increasing the size of the vector by N.
Definition SmallVector.h:198
bool isSafeToReferenceAfterResize(const void *Elt, size_t NewSize)
Return true unless Elt will be invalidated by resizing the vector to NewSize.
Definition SmallVector.h:176
void assertSafeToReferenceAfterResize(const void *Elt, size_t NewSize)
Check whether Elt will be invalidated by resizing the vector to NewSize.
Definition SmallVector.h:190
bool empty() const
Definition SmallVector.h:88
bool isRangeInStorage(const void *First, const void *Last) const
Return true if First and Last form a valid (possibly empty) range in this vector's storage.
Definition SmallVector.h:167
reference back()
Definition SmallVector.h:310
bool isReferenceToRange(const void *V, const void *First, const void *Last) const
Return true if V is an internal reference to the given range.
Definition SmallVector.h:154
void assertSafeToReferenceAfterClear(ItTy, ItTy)
Definition SmallVector.h:213
size_type max_size() const
Definition SmallVector.h:281
void grow_pod(size_t MinSize, size_t TSize)
Definition SmallVector.h:139
reverse_iterator rend()
Definition SmallVector.h:277
A range adaptor for a pair of iterators.
Definition iterator_range.h:42
IteratorT end() const
Definition iterator_range.h:65
IteratorT begin() const
Definition iterator_range.h:64
Definition PointerIntPair.h:280
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, cert-dcl58-cpp) is_nothrow_move_constructible< wpi::WPI_BASIC_JSON_TPL >::value &&//NOLINT(misc-redundant-expression, cppcoreguidelines-noexcept-swap, performance-noexcept-swap) is_nothrow_move_assignable< wpi::WPI_BASIC_JSON_TPL >::value)
exchanges the values of two JSON objects
Definition json.h:5258
Definition ntcore_cpp.h:26
iterator_range(Container &&) -> iterator_range< wpi::detail::IterOfRange< Container > >
SmallVector< ValueTypeFromRangeType< R >, Size > to_vector(R &&Range)
Given a range of type R, iterate the entire range and return a SmallVector with elements of the vecto...
Definition SmallVector.h:1301
std::remove_const_t< std::remove_reference_t< decltype(*std::begin( std::declval< RangeType & >()))> > ValueTypeFromRangeType
Definition SmallVector.h:1293
size_t capacity_in_bytes(const DenseMap< KeyT, ValueT, KeyInfoT > &X)
Definition DenseMap.h:1302
SmallVector< Out, Size > to_vector_of(R &&Range)
Definition SmallVector.h:1310
std::enable_if_t< std::is_convertible< typename std::iterator_traits< Iterator >::iterator_category, std::input_iterator_tag >::value > EnableIfConvertibleToInputIterator
Definition SmallVector.h:47
SmallVectorImpl< T >::size_type erase_if(SmallVectorImpl< T > &c, Pred pred)
Definition SmallVector.h:1319
Helper class for calculating the default number of inline elements for SmallVector<T>.
Definition SmallVector.h:1131
Figure out the offset of the first element.
Definition SmallVector.h:112
char FirstEl[sizeof(T)]
Definition SmallVector.h:115
Storage for the SmallVector elements.
Definition SmallVector.h:1112
#define S(label, offset, message)
Definition Errors.h:113