14#ifndef WPIUTIL_WPI_SMALLVECTOR_H
15#define WPIUTIL_WPI_SMALLVECTOR_H
22#pragma GCC diagnostic warning "-Wclass-memaccess"
34#include <initializer_list>
47template <
class Iterator>
49 typename std::iterator_traits<Iterator>::iterator_category,
50 std::input_iterator_tag>::value>;
67 return (std::numeric_limits<unsigned>::max)();
72 :
BeginX(FirstEl),
Capacity(static_cast<unsigned>(TotalCapacity)) {}
83 void grow_pod(
void *FirstEl,
size_t MinSize,
size_t TSize);
111 Size =
static_cast<unsigned>(N);
121 Capacity =
static_cast<unsigned>(N);
135template <
typename T,
typename =
void>
145 return const_cast<void *
>(
reinterpret_cast<const void *
>(
146 reinterpret_cast<const char *
>(
this) +
170 std::less<> LessThan;
171 return !LessThan(V, First) && LessThan(V, Last);
183 std::less<> LessThan;
184 return !LessThan(First, this->
begin()) && !LessThan(Last, First) &&
185 !LessThan(this->
end(), Last);
196 if (NewSize <= this->
size())
197 return Elt < this->
begin() + NewSize;
206 "Attempting to reference an element of the vector in an operation "
207 "that invalidates it");
225 std::enable_if_t<!std::is_same<std::remove_const_t<ItTy>, T *>::value,
238 std::enable_if_t<!std::is_same<std::remove_const_t<ItTy>, T *>::value,
247 size_t NewSize = This->size() + N;
251 bool ReferencesStorage =
false;
253 if (!U::TakesParamByValue) {
255 ReferencesStorage =
true;
256 Index = &Elt - This->begin();
260 return ReferencesStorage ? This->begin() + Index : &Elt;
307 assert(idx <
size());
311 assert(idx <
size());
342template <
typename T,
bool = (std::is_trivially_copy_constructible<T>::value) &&
343 (std::is_trivially_move_constructible<T>::value) &&
344 std::is_trivially_destructible<T>::value>
363 template<
typename It1,
typename It2>
365 std::uninitialized_move(I, E, Dest);
370 template<
typename It1,
typename It2>
372 std::uninitialized_copy(I, E, Dest);
400 return const_cast<T *
>(
411 std::uninitialized_fill_n(NewElts, NumElts, Elt);
421 ::new ((
void *)(NewElts + this->
size())) T(std::forward<ArgTypes>(Args)...);
431 ::new ((
void *)this->
end()) T(*EltPtr);
437 ::new ((
void *)this->
end()) T(::std::move(*EltPtr));
448template <
typename T,
bool TriviallyCopyable>
451 T *NewElts = mallocForGrow(MinSize, NewCapacity);
452 moveElementsForGrow(NewElts);
453 takeAllocationForGrow(NewElts, NewCapacity);
456template <
typename T,
bool TriviallyCopyable>
458 size_t MinSize,
size_t &NewCapacity) {
459 return static_cast<T *
>(
461 this->getFirstEl(), MinSize,
sizeof(T), NewCapacity));
465template <
typename T,
bool TriviallyCopyable>
469 this->uninitialized_move(this->begin(), this->end(), NewElts);
472 destroy_range(this->begin(), this->end());
476template <
typename T,
bool TriviallyCopyable>
478 T *NewElts,
size_t NewCapacity) {
480 if (!this->isSmall())
483 this->set_allocation_range(NewElts, NewCapacity);
501 using ValueParamT = std::conditional_t<TakesParamByValue, T, const T &>;
510 template<
typename It1,
typename It2>
518 template<
typename It1,
typename It2>
521 std::uninitialized_copy(I, E, Dest);
526 template <
typename T1,
typename T2>
528 T1 *I, T1 *E, T2 *Dest,
529 std::enable_if_t<std::is_same<std::remove_const_t<T1>, T2>::value> * =
536 memcpy(
reinterpret_cast<void *
>(Dest), I, (E - I) *
sizeof(T));
552 return const_cast<T *
>(
564 std::uninitialized_fill_n(this->
begin(), NumElts, Elt);
572 push_back(T(std::forward<ArgTypes>(Args)...));
579 memcpy(
reinterpret_cast<void *
>(this->
end()), EltPtr,
sizeof(T));
589class SmallVectorImpl :
public SmallVectorTemplateBase<T> {
610 this->
BeginX = RHS.BeginX;
611 this->
Size = RHS.Size;
635 template <
bool ForOverwrite>
void resizeImpl(
size_type N) {
636 if (N == this->
size())
639 if (N < this->
size()) {
645 for (
auto I = this->
end(), E = this->
begin() + N; I != E; ++I)
661 assert(this->
size() >= N &&
"Cannot increase size with truncate");
667 if (N == this->
size())
670 if (N < this->
size()) {
685 assert(this->
size() >= NumItems);
690 T Result = ::std::move(this->
back());
698 template <
typename ItTy,
typename = EnableIfConvertibleToInputIterator<ItTy>>
699 void append(ItTy in_start, ItTy in_end) {
701 size_type NumInputs = std::distance(in_start, in_end);
710 std::uninitialized_fill_n(this->
end(), NumInputs, *EltPtr);
714 void append(std::initializer_list<T> IL) {
715 append(IL.begin(), IL.end());
728 std::fill_n(this->
begin(), (std::min)(NumElts, this->
size()), Elt);
729 if (NumElts > this->
size())
730 std::uninitialized_fill_n(this->
end(), NumElts - this->
size(), Elt);
731 else if (NumElts < this->
size())
739 template <
typename ItTy,
typename = EnableIfConvertibleToInputIterator<ItTy>>
740 void assign(ItTy in_start, ItTy in_end) {
746 void assign(std::initializer_list<T> IL) {
761 std::move(I+1, this->
end(), I);
784 template <
class ArgType>
iterator insert_one_impl(
iterator I, ArgType &&Elt) {
787 std::is_same<std::remove_const_t<std::remove_reference_t<ArgType>>,
789 "ArgType must be derived from T!");
791 if (I == this->
end()) {
792 this->
push_back(::std::forward<ArgType>(Elt));
793 return this->
end()-1;
799 size_t Index = I - this->
begin();
800 std::remove_reference_t<ArgType> *EltPtr =
802 I = this->
begin() + Index;
804 ::new ((
void*) this->
end()) T(::
std::move(this->
back()));
806 std::move_backward(I, this->end()-1, this->end());
812 "ArgType must be 'T' when taking by value!");
816 *I = ::
std::forward<ArgType>(*EltPtr);
831 size_t InsertElt = I - this->
begin();
833 if (I == this->
end()) {
835 return this->
begin()+InsertElt;
845 I = this->
begin()+InsertElt;
851 if (
size_t(this->
end()-I) >= NumToInsert) {
852 T *OldEnd = this->
end();
853 append(std::move_iterator<iterator>(this->
end() - NumToInsert),
854 std::move_iterator<iterator>(this->
end()));
857 std::move_backward(I, OldEnd-NumToInsert, OldEnd);
862 EltPtr += NumToInsert;
864 std::fill_n(I, NumToInsert, *EltPtr);
872 T *OldEnd = this->
end();
874 size_t NumOverwritten = OldEnd-I;
880 EltPtr += NumToInsert;
883 std::fill_n(I, NumOverwritten, *EltPtr);
886 std::uninitialized_fill_n(OldEnd, NumToInsert - NumOverwritten, *EltPtr);
890 template <
typename ItTy,
typename = EnableIfConvertibleToInputIterator<ItTy>>
893 size_t InsertElt = I - this->
begin();
895 if (I == this->
end()) {
897 return this->
begin()+InsertElt;
905 size_t NumToInsert = std::distance(From, To);
911 I = this->
begin()+InsertElt;
917 if (
size_t(this->
end()-I) >= NumToInsert) {
918 T *OldEnd = this->
end();
919 append(std::move_iterator<iterator>(this->
end() - NumToInsert),
920 std::move_iterator<iterator>(this->
end()));
923 std::move_backward(I, OldEnd-NumToInsert, OldEnd);
925 std::copy(From, To, I);
933 T *OldEnd = this->
end();
935 size_t NumOverwritten = OldEnd-I;
939 for (T *J = I; NumOverwritten > 0; --NumOverwritten) {
950 insert(I, IL.begin(), IL.end());
957 ::new ((
void *)this->
end()) T(std::forward<ArgTypes>(Args)...);
967 if (this->
size() != RHS.size())
return false;
968 return std::equal(this->
begin(), this->
end(), RHS.begin());
971 return !(*
this == RHS);
975 return std::lexicographical_compare(this->
begin(), this->
end(),
976 RHS.begin(), RHS.end());
985 if (
this == &RHS)
return;
988 if (!this->
isSmall() && !RHS.isSmall()) {
995 RHS.reserve(this->
size());
998 size_t NumShared = this->
size();
999 if (NumShared > RHS.size()) NumShared = RHS.size();
1000 for (
size_type i = 0; i != NumShared; ++i)
1004 if (this->
size() > RHS.size()) {
1005 size_t EltDiff = this->
size() - RHS.size();
1007 RHS.set_size(RHS.size() + EltDiff);
1010 }
else if (RHS.size() > this->size()) {
1011 size_t EltDiff = RHS.size() - this->
size();
1015 RHS.set_size(NumShared);
1019template <
typename T>
1023 if (
this == &RHS)
return *
this;
1027 size_t RHSSize = RHS.size();
1028 size_t CurSize = this->
size();
1029 if (CurSize >= RHSSize) {
1033 NewEnd = std::copy(RHS.begin(), RHS.begin()+RHSSize, this->begin());
1035 NewEnd = this->
begin();
1052 this->
grow(RHSSize);
1053 }
else if (CurSize) {
1055 std::copy(RHS.begin(), RHS.begin()+CurSize, this->begin());
1060 this->begin()+CurSize);
1067template <
typename T>
1070 if (
this == &RHS)
return *
this;
1073 if (!RHS.isSmall()) {
1080 size_t RHSSize = RHS.
size();
1081 size_t CurSize = this->
size();
1082 if (CurSize >= RHSSize) {
1086 NewEnd = std::move(RHS.begin(), RHS.end(), NewEnd);
1106 this->
grow(RHSSize);
1107 }
else if (CurSize) {
1109 std::move(RHS.begin(), RHS.begin()+CurSize, this->begin());
1114 this->begin()+CurSize);
1125template <
typename T,
unsigned N>
1127 alignas(T)
char InlineElts[N *
sizeof(T)];
1153 static constexpr size_t kPreferredSmallVectorSizeof = 64;
1179 "You are trying to use a default number of inlined elements for "
1180 "`SmallVector<T>` but `sizeof(T)` is really big! Please use an "
1181 "explicit number of inlined elements with `SmallVector<T, N>` to make "
1182 "sure you really want that much inline storage.");
1186 static constexpr size_t PreferredInlineBytes =
1188 static constexpr size_t NumElementsThatFit = PreferredInlineBytes /
sizeof(T);
1189 static constexpr size_t value =
1190 NumElementsThatFit == 0 ? 1 : NumElementsThatFit;
1209template <
typename T,
1218 this->destroy_range(this->begin(), this->end());
1228 this->assign(Size, Value);
1231 template <
typename ItTy,
typename = EnableIfConvertibleToInputIterator<ItTy>>
1236 template <
typename RangeTy>
1246 template <
typename U,
1247 typename = std::enable_if_t<std::is_convertible<U, T>::value>>
1249 this->append(A.begin(), A.end());
1282 this->destroy_range(this->begin(), this->end());
1285 this->assignRemote(std::move(RHS));
1301template <
typename T,
unsigned N>
1306template <
typename RangeType>
1308 std::remove_const_t<std::remove_reference_t<
decltype(*std::begin(
1309 std::declval<RangeType &>()))>>;
1314template <
unsigned Size,
typename R>
1316 return {std::begin(Range), std::end(Range)};
1318template <
typename R>
1320 return {std::begin(Range), std::end(Range)};
1323template <
typename Out,
unsigned Size,
typename R>
1325 return {std::begin(Range), std::end(Range)};
1329 return {std::begin(Range), std::end(Range)};
1332template <
typename T,
typename Pred>
1335 const auto original_size = c.size();
1336 c.erase(std::remove_if(c.begin(), c.end(), pred), c.end());
1337 return original_size - c.size();
1345 template<
typename T>
1352 template<
typename T,
unsigned N>
#define LLVM_UNLIKELY(EXPR)
Definition Compiler.h:253
#define LLVM_GSL_OWNER
LLVM_GSL_OWNER - Apply this to owning classes like SmallVector to enable lifetime warnings.
Definition Compiler.h:349
#define LLVM_LIKELY(EXPR)
Definition Compiler.h:252
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 and nanopb were all 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:164
This is all the stuff common to all SmallVectors.
Definition SmallVector.h:60
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:62
size_t size() const
Definition SmallVector.h:99
void * replaceAllocation(void *NewElts, size_t TSize, size_t NewCapacity, size_t VSize=0)
If vector was first created with capacity 0, getFirstEl() points to the memory right after,...
unsigned Capacity
Definition SmallVector.h:63
unsigned Size
Definition SmallVector.h:63
size_t capacity() const
Definition SmallVector.h:100
static constexpr size_t SizeTypeMax()
The maximum value of the unsigned used.
Definition SmallVector.h:66
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:71
bool empty() const
Definition SmallVector.h:102
void set_allocation_range(void *Begin, size_t N)
Set the array data pointer to Begin and capacity to N.
Definition SmallVector.h:118
void set_size(size_t N)
Set the array size to N, which the current array must have enough capacity for.
Definition SmallVector.h:109
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition SmallVector.h:1212
SmallVector(ItTy S, ItTy E)
Definition SmallVector.h:1232
SmallVector(std::span< const U > A)
Definition SmallVector.h:1248
SmallVector(size_t Size, const T &Value)
Definition SmallVector.h:1226
SmallVector(const iterator_range< RangeTy > &R)
Definition SmallVector.h:1237
~SmallVector()
Definition SmallVector.h:1216
SmallVector(std::initializer_list< T > IL)
Definition SmallVector.h:1242
SmallVector(SmallVectorImpl< T > &&RHS)
Definition SmallVector.h:1267
SmallVector & operator=(SmallVectorImpl< T > &&RHS)
Definition SmallVector.h:1290
SmallVector()
Definition SmallVector.h:1214
SmallVector(size_t Size)
Definition SmallVector.h:1221
SmallVector(const SmallVector &RHS)
Definition SmallVector.h:1252
SmallVector & operator=(SmallVector &&RHS)
Definition SmallVector.h:1272
SmallVector & operator=(const SmallVector &RHS)
Definition SmallVector.h:1257
SmallVector(SmallVector &&RHS)
Definition SmallVector.h:1262
SmallVector & operator=(std::initializer_list< T > IL)
Definition SmallVector.h:1295
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:970
SmallVectorImpl & operator=(SmallVectorImpl &&RHS)
Definition SmallVector.h:1068
iterator erase(const_iterator CI)
Definition SmallVector.h:753
~SmallVectorImpl()
Definition SmallVector.h:616
reference emplace_back(ArgTypes &&... Args)
Definition SmallVector.h:953
void resize_for_overwrite(size_type N)
Like resize, but T is POD, the new values won't be initialized.
Definition SmallVector.h:657
void assign(std::initializer_list< T > IL)
Definition SmallVector.h:746
void append(std::initializer_list< T > IL)
Definition SmallVector.h:714
iterator insert(iterator I, ItTy From, ItTy To)
Definition SmallVector.h:891
bool operator==(const SmallVectorImpl &RHS) const
Definition SmallVector.h:966
T pop_back_val()
Definition SmallVector.h:689
SmallVectorImpl(unsigned N)
Definition SmallVector.h:603
SmallVectorImpl & operator=(const SmallVectorImpl &RHS)
Definition SmallVector.h:1021
bool operator>(const SmallVectorImpl &RHS) const
Definition SmallVector.h:978
void clear()
Definition SmallVector.h:626
void assignRemote(SmallVectorImpl &&RHS)
Definition SmallVector.h:606
bool operator<=(const SmallVectorImpl &RHS) const
Definition SmallVector.h:979
typename SuperClass::size_type size_type
Definition SmallVector.h:596
void swap(SmallVectorImpl &RHS)
Definition SmallVector.h:984
iterator insert(iterator I, T &&Elt)
Definition SmallVector.h:821
void reserve(size_type N)
Definition SmallVector.h:679
void assign(const SmallVectorImpl &RHS)
Definition SmallVector.h:751
void truncate(size_type N)
Like resize, but requires that N is less than size().
Definition SmallVector.h:660
typename SuperClass::iterator iterator
Definition SmallVector.h:593
bool operator<(const SmallVectorImpl &RHS) const
Definition SmallVector.h:974
void assign(size_type NumElts, ValueParamT Elt)
Definition SmallVector.h:720
typename SuperClass::ValueParamT ValueParamT
Definition SmallVector.h:600
typename SuperClass::const_iterator const_iterator
Definition SmallVector.h:594
iterator insert(iterator I, size_type NumToInsert, ValueParamT Elt)
Definition SmallVector.h:829
typename SuperClass::reference reference
Definition SmallVector.h:595
void append(const SmallVectorImpl &RHS)
Definition SmallVector.h:718
SmallVectorImpl(const SmallVectorImpl &)=delete
void resize(size_type N, ValueParamT NV)
Definition SmallVector.h:666
void pop_back_n(size_type NumItems)
Definition SmallVector.h:684
void assign(ItTy in_start, ItTy in_end)
Definition SmallVector.h:740
void insert(iterator I, std::initializer_list< T > IL)
Definition SmallVector.h:949
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
Definition SmallVector.h:699
void append(size_type NumInputs, ValueParamT Elt)
Append NumInputs copies of Elt to the end.
Definition SmallVector.h:708
bool operator>=(const SmallVectorImpl &RHS) const
Definition SmallVector.h:980
void resize(size_type N)
Definition SmallVector.h:654
iterator insert(iterator I, const T &Elt)
Definition SmallVector.h:825
iterator erase(const_iterator CS, const_iterator CE)
Definition SmallVector.h:767
void growAndAssign(size_t NumElts, T Elt)
Definition SmallVector.h:559
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:501
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:545
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:527
static ValueParamT forward_value_param(ValueParamT V)
Copy V or return a reference, depending on ValueParamT.
Definition SmallVector.h:557
static void destroy_range(T *, T *)
Definition SmallVector.h:506
SmallVectorTemplateBase(size_t Size)
Definition SmallVector.h:503
T & growAndEmplaceBack(ArgTypes &&... Args)
Definition SmallVector.h:568
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:541
void push_back(ValueParamT Elt)
Definition SmallVector.h:577
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:519
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:551
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:511
void pop_back()
Definition SmallVector.h:583
SmallVectorTemplateBase<TriviallyCopyable = false> - This is where we put method implementations that...
Definition SmallVector.h:345
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:364
void moveElementsForGrow(T *NewElts)
Move existing elements over to the new allocation NewElts, the middle section of grow().
Definition SmallVector.h:466
SmallVectorTemplateBase(size_t Size)
Definition SmallVector.h:352
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:371
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:399
const T & ValueParamT
Definition SmallVector.h:350
void pop_back()
Definition SmallVector.h:441
static const T & forward_value_param(const T &V)
Definition SmallVector.h:405
static void destroy_range(T *S, T *E)
Definition SmallVector.h:354
void takeAllocationForGrow(T *NewElts, size_t NewCapacity)
Transfer ownership of the allocation, finishing up grow().
Definition SmallVector.h:477
static T && forward_value_param(T &&V)
Definition SmallVector.h:404
static constexpr bool TakesParamByValue
Definition SmallVector.h:349
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:457
void push_back(T &&Elt)
Definition SmallVector.h:435
void grow(size_t MinSize=0)
Grow the allocated memory (without initializing new elements), doubling the size of the allocated mem...
Definition SmallVector.h:449
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:393
T & growAndEmplaceBack(ArgTypes &&... Args)
Definition SmallVector.h:417
void push_back(const T &Elt)
Definition SmallVector.h:429
void growAndAssign(size_t NumElts, const T &Elt)
Definition SmallVector.h:407
This is the part of SmallVectorTemplateBase which does not depend on whether the type T is a POD.
Definition SmallVector.h:137
ptrdiff_t difference_type
Definition SmallVector.h:265
const T * const_pointer
Definition SmallVector.h:276
void assertSafeToReferenceAfterClear(const T *From, const T *To)
Check whether any part of the range will be invalidated by clearing.
Definition SmallVector.h:217
reverse_iterator rbegin()
Definition SmallVector.h:289
const_iterator begin() const
Definition SmallVector.h:284
reference front()
Definition SmallVector.h:315
size_t size() const
Definition SmallVector.h:99
size_type size_in_bytes() const
Definition SmallVector.h:294
void resetToSmall()
Put this vector in a state of being small.
Definition SmallVector.h:162
void * getFirstEl() const
Find the address of the first element.
Definition SmallVector.h:144
const_reverse_iterator rbegin() const
Definition SmallVector.h:290
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition SmallVector.h:270
const_reference operator[](size_type idx) const
Definition SmallVector.h:310
bool isReferenceToStorage(const void *V) const
Return true if V is an internal reference to this vector.
Definition SmallVector.h:175
const_pointer data() const
Return a pointer to the vector's buffer, even if empty().
Definition SmallVector.h:304
pointer data()
Return a pointer to the vector's buffer, even if empty().
Definition SmallVector.h:302
size_t capacity() const
Definition SmallVector.h:100
iterator begin()
Definition SmallVector.h:283
T * iterator
Definition SmallVector.h:267
const_reference back() const
Definition SmallVector.h:328
const T & const_reference
Definition SmallVector.h:274
size_t size_type
Definition SmallVector.h:264
reference operator[](size_type idx)
Definition SmallVector.h:306
size_t capacity_in_bytes() const
Definition SmallVector.h:299
const_reverse_iterator rend() const
Definition SmallVector.h:292
std::reverse_iterator< iterator > reverse_iterator
Definition SmallVector.h:271
const_iterator end() const
Definition SmallVector.h:286
bool isSmall() const
Return true if this is a smallvector which has not had dynamic memory allocated for it.
Definition SmallVector.h:159
T value_type
Definition SmallVector.h:266
iterator end()
Definition SmallVector.h:285
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:245
void assertSafeToAddRange(ItTy, ItTy)
Definition SmallVector.h:240
SmallVectorTemplateCommon(size_t Size)
Definition SmallVector.h:151
void assertSafeToAddRange(const T *From, const T *To)
Check whether any part of the range will be invalidated by growing.
Definition SmallVector.h:230
const_reference front() const
Definition SmallVector.h:319
T & reference
Definition SmallVector.h:273
const T * const_iterator
Definition SmallVector.h:268
T * pointer
Definition SmallVector.h:275
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:212
bool isSafeToReferenceAfterResize(const void *Elt, size_t NewSize)
Return true unless Elt will be invalidated by resizing the vector to NewSize.
Definition SmallVector.h:190
void assertSafeToReferenceAfterResize(const void *Elt, size_t NewSize)
Check whether Elt will be invalidated by resizing the vector to NewSize.
Definition SmallVector.h:204
bool empty() const
Definition SmallVector.h:102
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:181
reference back()
Definition SmallVector.h:324
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:168
void assertSafeToReferenceAfterClear(ItTy, ItTy)
Definition SmallVector.h:227
size_type max_size() const
Definition SmallVector.h:295
void grow_pod(size_t MinSize, size_t TSize)
Definition SmallVector.h:153
reverse_iterator rend()
Definition SmallVector.h:291
A range adaptor for a pair of iterators.
Definition iterator_range.h:42
IteratorT end() const
Definition iterator_range.h:64
IteratorT begin() const
Definition iterator_range.h:63
Implement std::hash so that hash_code can be used in STL containers.
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
Foonathan namespace.
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:1315
std::remove_const_t< std::remove_reference_t< decltype(*std::begin( std::declval< RangeType & >()))> > ValueTypeFromRangeType
Definition SmallVector.h:1307
size_t capacity_in_bytes(const DenseMap< KeyT, ValueT, KeyInfoT > &X)
Definition DenseMap.h:1347
SmallVector< Out, Size > to_vector_of(R &&Range)
Definition SmallVector.h:1324
std::enable_if_t< std::is_convertible< typename std::iterator_traits< Iterator >::iterator_category, std::input_iterator_tag >::value > EnableIfConvertibleToInputIterator
Definition SmallVector.h:48
SmallVectorImpl< T >::size_type erase_if(SmallVectorImpl< T > &c, Pred pred)
Definition SmallVector.h:1333
Helper class for calculating the default number of inline elements for SmallVector<T>.
Definition SmallVector.h:1145
Figure out the offset of the first element.
Definition SmallVector.h:126
char FirstEl[sizeof(T)]
Definition SmallVector.h:129
Storage for the SmallVector elements.
Definition SmallVector.h:1126
#define S(label, offset, message)
Definition Errors.h:113