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>;
71 :
BeginX(FirstEl),
Capacity(static_cast<unsigned>(TotalCapacity)) {}
82 void grow_pod(
void *FirstEl,
size_t MinSize,
size_t TSize);
110 Size =
static_cast<unsigned>(N);
124template <
typename T,
typename =
void>
134 return const_cast<void *
>(
reinterpret_cast<const void *
>(
135 reinterpret_cast<const char *
>(
this) +
159 std::less<> LessThan;
160 return !LessThan(V, First) && LessThan(V, Last);
172 std::less<> LessThan;
173 return !LessThan(First, this->
begin()) && !LessThan(Last, First) &&
174 !LessThan(this->
end(), Last);
185 if (NewSize <= this->
size())
186 return Elt < this->
begin() + NewSize;
195 "Attempting to reference an element of the vector in an operation "
196 "that invalidates it");
214 std::enable_if_t<!std::is_same<std::remove_const_t<ItTy>, T *>::value,
227 std::enable_if_t<!std::is_same<std::remove_const_t<ItTy>, T *>::value,
236 size_t NewSize = This->size() + N;
240 bool ReferencesStorage =
false;
242 if (!U::TakesParamByValue) {
244 ReferencesStorage =
true;
245 Index = &Elt - This->begin();
249 return ReferencesStorage ? This->begin() + Index : &Elt;
296 assert(idx <
size());
300 assert(idx <
size());
331template <
typename T,
bool = (std::is_trivially_copy_constructible<T>::value) &&
332 (std::is_trivially_move_constructible<T>::value) &&
333 std::is_trivially_destructible<T>::value>
352 template<
typename It1,
typename It2>
354 std::uninitialized_move(I, E, Dest);
359 template<
typename It1,
typename It2>
361 std::uninitialized_copy(I, E, Dest);
389 return const_cast<T *
>(
400 std::uninitialized_fill_n(NewElts, NumElts, Elt);
410 ::new ((
void *)(NewElts + this->
size())) T(std::forward<ArgTypes>(Args)...);
420 ::new ((
void *)this->
end()) T(*EltPtr);
426 ::new ((
void *)this->
end()) T(::std::move(*EltPtr));
437template <
typename T,
bool TriviallyCopyable>
440 T *NewElts = mallocForGrow(MinSize, NewCapacity);
441 moveElementsForGrow(NewElts);
442 takeAllocationForGrow(NewElts, NewCapacity);
445template <
typename T,
bool TriviallyCopyable>
447 size_t MinSize,
size_t &NewCapacity) {
448 return static_cast<T *
>(
450 this->getFirstEl(), MinSize,
sizeof(T), NewCapacity));
454template <
typename T,
bool TriviallyCopyable>
458 this->uninitialized_move(this->begin(), this->end(), NewElts);
461 destroy_range(this->begin(), this->end());
465template <
typename T,
bool TriviallyCopyable>
467 T *NewElts,
size_t NewCapacity) {
469 if (!this->isSmall())
472 this->BeginX = NewElts;
473 this->Capacity =
static_cast<unsigned>(NewCapacity);
491 using ValueParamT = std::conditional_t<TakesParamByValue, T, const T &>;
500 template<
typename It1,
typename It2>
508 template<
typename It1,
typename It2>
511 std::uninitialized_copy(I, E, Dest);
516 template <
typename T1,
typename T2>
518 T1 *I, T1 *E, T2 *Dest,
526 memcpy(
reinterpret_cast<void *
>(Dest), I, (E - I) *
sizeof(T));
542 return const_cast<T *
>(
554 std::uninitialized_fill_n(this->
begin(), NumElts, Elt);
562 push_back(T(std::forward<ArgTypes>(Args)...));
569 memcpy(
reinterpret_cast<void *
>(this->
end()), EltPtr,
sizeof(T));
600 this->
BeginX = RHS.BeginX;
601 this->
Size = RHS.Size;
625 template <
bool ForOverwrite>
void resizeImpl(
size_type N) {
626 if (N == this->
size())
629 if (N < this->
size()) {
635 for (
auto I = this->
end(), E = this->
begin() + N; I != E; ++I)
651 assert(this->
size() >= N &&
"Cannot increase size with truncate");
657 if (N == this->
size())
660 if (N < this->
size()) {
675 assert(this->
size() >= NumItems);
680 T Result = ::std::move(this->
back());
688 template <
typename ItTy,
typename = EnableIfConvertibleToInputIterator<ItTy>>
689 void append(ItTy in_start, ItTy in_end) {
691 size_type NumInputs = std::distance(in_start, in_end);
700 std::uninitialized_fill_n(this->
end(), NumInputs, *EltPtr);
704 void append(std::initializer_list<T> IL) {
705 append(IL.begin(), IL.end());
719 if (NumElts > this->
size())
720 std::uninitialized_fill_n(this->
end(), NumElts - this->
size(), Elt);
721 else if (NumElts < this->
size())
729 template <
typename ItTy,
typename = EnableIfConvertibleToInputIterator<ItTy>>
730 void assign(ItTy in_start, ItTy in_end) {
736 void assign(std::initializer_list<T> IL) {
751 std::move(I+1, this->
end(), I);
774 template <
class ArgType>
iterator insert_one_impl(
iterator I, ArgType &&Elt) {
777 std::is_same<std::remove_const_t<std::remove_reference_t<ArgType>>,
779 "ArgType must be derived from T!");
781 if (I == this->
end()) {
782 this->
push_back(::std::forward<ArgType>(Elt));
783 return this->
end()-1;
789 size_t Index = I - this->
begin();
790 std::remove_reference_t<ArgType> *EltPtr =
792 I = this->
begin() + Index;
794 ::new ((
void*) this->
end()) T(::
std::move(this->
back()));
796 std::move_backward(I, this->
end()-1, this->
end());
802 "ArgType must be 'T' when taking
by value!");
806 *I = ::
std::forward<ArgType>(*EltPtr);
821 size_t InsertElt = I - this->
begin();
823 if (I == this->
end()) {
825 return this->
begin()+InsertElt;
835 I = this->
begin()+InsertElt;
841 if (
size_t(this->
end()-I) >= NumToInsert) {
842 T *OldEnd = this->
end();
843 append(std::move_iterator<iterator>(this->
end() - NumToInsert),
844 std::move_iterator<iterator>(this->
end()));
847 std::move_backward(I, OldEnd-NumToInsert, OldEnd);
852 EltPtr += NumToInsert;
862 T *OldEnd = this->
end();
864 size_t NumOverwritten = OldEnd-I;
870 EltPtr += NumToInsert;
876 std::uninitialized_fill_n(OldEnd, NumToInsert - NumOverwritten, *EltPtr);
880 template <
typename ItTy,
typename = EnableIfConvertibleToInputIterator<ItTy>>
883 size_t InsertElt = I - this->
begin();
885 if (I == this->
end()) {
887 return this->
begin()+InsertElt;
895 size_t NumToInsert = std::distance(From, To);
901 I = this->
begin()+InsertElt;
907 if (
size_t(this->
end()-I) >= NumToInsert) {
908 T *OldEnd = this->
end();
909 append(std::move_iterator<iterator>(this->
end() - NumToInsert),
910 std::move_iterator<iterator>(this->
end()));
913 std::move_backward(I, OldEnd-NumToInsert, OldEnd);
923 T *OldEnd = this->
end();
925 size_t NumOverwritten = OldEnd-I;
929 for (T *J = I; NumOverwritten > 0; --NumOverwritten) {
940 insert(I, IL.begin(), IL.end());
947 ::new ((
void *)this->
end()) T(std::forward<ArgTypes>(Args)...);
957 if (this->
size() != RHS.
size())
return false;
961 return !(*
this == RHS);
965 return std::lexicographical_compare(this->
begin(), this->
end(),
975 if (
this == &RHS)
return;
988 size_t NumShared = this->
size();
989 if (NumShared > RHS.
size()) NumShared = RHS.
size();
990 for (
size_type i = 0; i != NumShared; ++i)
995 size_t EltDiff = this->
size() - RHS.
size();
1000 }
else if (RHS.
size() > this->size()) {
1001 size_t EltDiff = RHS.
size() - this->
size();
1009template <
typename T>
1013 if (
this == &RHS)
return *
this;
1017 size_t RHSSize = RHS.
size();
1018 size_t CurSize = this->
size();
1019 if (CurSize >= RHSSize) {
1025 NewEnd = this->
begin();
1042 this->
grow(RHSSize);
1043 }
else if (CurSize) {
1050 this->begin()+CurSize);
1057template <
typename T>
1060 if (
this == &RHS)
return *
this;
1063 if (!RHS.isSmall()) {
1070 size_t RHSSize = RHS.size();
1071 size_t CurSize = this->
size();
1072 if (CurSize >= RHSSize) {
1076 NewEnd = std::move(RHS.begin(), RHS.end(), NewEnd);
1096 this->
grow(RHSSize);
1097 }
else if (CurSize) {
1099 std::move(RHS.begin(), RHS.begin()+CurSize, this->begin());
1104 this->begin()+CurSize);
1115template <
typename T,
unsigned N>
1117 alignas(T)
char InlineElts[N *
sizeof(T)];
1143 static constexpr size_t kPreferredSmallVectorSizeof = 64;
1169 "You are trying to use a default number of inlined elements for "
1170 "`SmallVector<T>` but `sizeof(T)` is really big! Please use an "
1171 "explicit number of inlined elements with `SmallVector<T, N>` to make "
1172 "sure you really want that much inline storage.");
1176 static constexpr size_t PreferredInlineBytes =
1178 static constexpr size_t NumElementsThatFit = PreferredInlineBytes /
sizeof(T);
1179 static constexpr size_t value =
1180 NumElementsThatFit == 0 ? 1 : NumElementsThatFit;
1199template <
typename T,
1218 this->
assign(Size, Value);
1221 template <
typename ItTy,
typename = EnableIfConvertibleToInputIterator<ItTy>>
1226 template <
typename RangeTy>
1236 template <
typename U,
1237 typename = std::enable_if_t<std::is_convertible<U, T>::value>>
1239 this->
append(A.begin(), A.end());
1291template <
typename T,
unsigned N>
1296template <
typename RangeType>
1299 std::declval<RangeType &>()))>>;
1304template <
unsigned Size,
typename R>
1306 return {std::begin(Range), std::end(Range)};
1308template <
typename R>
1310 return {std::begin(Range), std::end(Range)};
1313template <
typename Out,
unsigned Size,
typename R>
1315 return {std::begin(Range), std::end(Range)};
1319 return {std::begin(Range), std::end(Range)};
1327 template<
typename T>
1334 template<
typename T,
unsigned N>
#define LLVM_UNLIKELY(EXPR)
Definition: Compiler.h:234
#define LLVM_GSL_OWNER
LLVM_GSL_OWNER - Apply this to owning classes like SmallVector to enable lifetime warnings.
Definition: Compiler.h:322
#define LLVM_LIKELY(EXPR)
Definition: Compiler.h:233
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 by
Definition: ThirdPartyNotices.txt:140
you may not use this file except in compliance with the License You may obtain a copy of the License at software distributed under the License is distributed on an AS IS WITHOUT WARRANTIES OR CONDITIONS OF ANY either express or implied See the License for the specific language governing permissions and limitations under the License LLVM Exceptions to the Apache License As an if
Definition: ThirdPartyNotices.txt:289
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
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:98
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:62
unsigned Size
Definition: SmallVector.h:62
size_t capacity() const
Definition: SmallVector.h:99
static constexpr size_t SizeTypeMax()
The maximum value of the Size_T 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:101
void set_size(size_t N)
Set the array size to N, which the current array must have enough capacity for.
Definition: SmallVector.h:108
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1202
SmallVector(ItTy S, ItTy E)
Definition: SmallVector.h:1222
SmallVector(std::span< const U > A)
Definition: SmallVector.h:1238
SmallVector(size_t Size, const T &Value)
Definition: SmallVector.h:1216
SmallVector(const iterator_range< RangeTy > &R)
Definition: SmallVector.h:1227
~SmallVector()
Definition: SmallVector.h:1206
SmallVector(std::initializer_list< T > IL)
Definition: SmallVector.h:1232
SmallVector(SmallVectorImpl< T > &&RHS)
Definition: SmallVector.h:1257
SmallVector & operator=(SmallVectorImpl< T > &&RHS)
Definition: SmallVector.h:1280
SmallVector()
Definition: SmallVector.h:1204
SmallVector(size_t Size)
Definition: SmallVector.h:1211
SmallVector(const SmallVector &RHS)
Definition: SmallVector.h:1242
SmallVector & operator=(SmallVector &&RHS)
Definition: SmallVector.h:1262
SmallVector & operator=(const SmallVector &RHS)
Definition: SmallVector.h:1247
SmallVector(SmallVector &&RHS)
Definition: SmallVector.h:1252
SmallVector & operator=(std::initializer_list< T > IL)
Definition: SmallVector.h:1285
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:579
bool operator!=(const SmallVectorImpl &RHS) const
Definition: SmallVector.h:960
SmallVectorImpl & operator=(SmallVectorImpl &&RHS)
Definition: SmallVector.h:1058
iterator erase(const_iterator CI)
Definition: SmallVector.h:743
~SmallVectorImpl()
Definition: SmallVector.h:609
reference emplace_back(ArgTypes &&... Args)
Definition: SmallVector.h:943
void resize_for_overwrite(size_type N)
Like resize, but T is POD, the new values won't be initialized.
Definition: SmallVector.h:647
void assign(std::initializer_list< T > IL)
Definition: SmallVector.h:736
void append(std::initializer_list< T > IL)
Definition: SmallVector.h:704
iterator insert(iterator I, ItTy From, ItTy To)
Definition: SmallVector.h:881
bool operator==(const SmallVectorImpl &RHS) const
Definition: SmallVector.h:956
T pop_back_val()
Definition: SmallVector.h:679
SmallVectorImpl(unsigned N)
Definition: SmallVector.h:593
SmallVectorImpl & operator=(const SmallVectorImpl &RHS)
Definition: SmallVector.h:1011
bool operator>(const SmallVectorImpl &RHS) const
Definition: SmallVector.h:968
void clear()
Definition: SmallVector.h:616
void assignRemote(SmallVectorImpl &&RHS)
Definition: SmallVector.h:596
bool operator<=(const SmallVectorImpl &RHS) const
Definition: SmallVector.h:969
typename SuperClass::size_type size_type
Definition: SmallVector.h:586
void swap(SmallVectorImpl &RHS)
Definition: SmallVector.h:974
iterator insert(iterator I, T &&Elt)
Definition: SmallVector.h:811
void reserve(size_type N)
Definition: SmallVector.h:669
void assign(const SmallVectorImpl &RHS)
Definition: SmallVector.h:741
void truncate(size_type N)
Like resize, but requires that N is less than size().
Definition: SmallVector.h:650
typename SuperClass::iterator iterator
Definition: SmallVector.h:583
bool operator<(const SmallVectorImpl &RHS) const
Definition: SmallVector.h:964
void assign(size_type NumElts, ValueParamT Elt)
Definition: SmallVector.h:710
iterator insert(iterator I, size_type NumToInsert, ValueParamT Elt)
Definition: SmallVector.h:819
void append(const SmallVectorImpl &RHS)
Definition: SmallVector.h:708
SmallVectorImpl(const SmallVectorImpl &)=delete
void resize(size_type N, ValueParamT NV)
Definition: SmallVector.h:656
void pop_back_n(size_type NumItems)
Definition: SmallVector.h:674
void assign(ItTy in_start, ItTy in_end)
Definition: SmallVector.h:730
void insert(iterator I, std::initializer_list< T > IL)
Definition: SmallVector.h:939
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
Definition: SmallVector.h:689
void append(size_type NumInputs, ValueParamT Elt)
Append NumInputs copies of Elt to the end.
Definition: SmallVector.h:698
bool operator>=(const SmallVectorImpl &RHS) const
Definition: SmallVector.h:970
void resize(size_type N)
Definition: SmallVector.h:644
iterator insert(iterator I, const T &Elt)
Definition: SmallVector.h:815
iterator erase(const_iterator CS, const_iterator CE)
Definition: SmallVector.h:757
void growAndAssign(size_t NumElts, T Elt)
Definition: SmallVector.h:549
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:491
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:535
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:517
static ValueParamT forward_value_param(ValueParamT V)
Copy V or return a reference, depending on ValueParamT.
Definition: SmallVector.h:547
static void destroy_range(T *, T *)
Definition: SmallVector.h:496
SmallVectorTemplateBase(size_t Size)
Definition: SmallVector.h:493
T & growAndEmplaceBack(ArgTypes &&... Args)
Definition: SmallVector.h:558
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:531
void push_back(ValueParamT Elt)
Definition: SmallVector.h:567
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:509
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:541
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:501
void pop_back()
Definition: SmallVector.h:573
SmallVectorTemplateBase<TriviallyCopyable = false> - This is where we put method implementations that...
Definition: SmallVector.h:334
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:353
void moveElementsForGrow(T *NewElts)
Move existing elements over to the new allocation NewElts, the middle section of grow().
Definition: SmallVector.h:455
SmallVectorTemplateBase(size_t Size)
Definition: SmallVector.h:341
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:360
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:388
const T & ValueParamT
Definition: SmallVector.h:339
void pop_back()
Definition: SmallVector.h:430
static const T & forward_value_param(const T &V)
Definition: SmallVector.h:394
static void destroy_range(T *S, T *E)
Definition: SmallVector.h:343
void takeAllocationForGrow(T *NewElts, size_t NewCapacity)
Transfer ownership of the allocation, finishing up grow().
Definition: SmallVector.h:466
static T && forward_value_param(T &&V)
Definition: SmallVector.h:393
static constexpr bool TakesParamByValue
Definition: SmallVector.h:338
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:446
void push_back(T &&Elt)
Definition: SmallVector.h:424
void grow(size_t MinSize=0)
Grow the allocated memory (without initializing new elements), doubling the size of the allocated mem...
Definition: SmallVector.h:438
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:382
T & growAndEmplaceBack(ArgTypes &&... Args)
Definition: SmallVector.h:406
void push_back(const T &Elt)
Definition: SmallVector.h:418
void growAndAssign(size_t NumElts, const T &Elt)
Definition: SmallVector.h:396
This is the part of SmallVectorTemplateBase which does not depend on whether the type T is a POD.
Definition: SmallVector.h:126
ptrdiff_t difference_type
Definition: SmallVector.h:254
const T * const_pointer
Definition: SmallVector.h:265
void assertSafeToReferenceAfterClear(const T *From, const T *To)
Check whether any part of the range will be invalidated by clearing.
Definition: SmallVector.h:206
reverse_iterator rbegin()
Definition: SmallVector.h:278
const_iterator begin() const
Definition: SmallVector.h:273
reference front()
Definition: SmallVector.h:304
size_t size() const
Definition: SmallVector.h:98
size_type size_in_bytes() const
Definition: SmallVector.h:283
void resetToSmall()
Put this vector in a state of being small.
Definition: SmallVector.h:151
void * getFirstEl() const
Find the address of the first element.
Definition: SmallVector.h:133
const_reverse_iterator rbegin() const
Definition: SmallVector.h:279
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: SmallVector.h:259
const_reference operator[](size_type idx) const
Definition: SmallVector.h:299
bool isReferenceToStorage(const void *V) const
Return true if V is an internal reference to this vector.
Definition: SmallVector.h:164
const_pointer data() const
Return a pointer to the vector's buffer, even if empty().
Definition: SmallVector.h:293
pointer data()
Return a pointer to the vector's buffer, even if empty().
Definition: SmallVector.h:291
size_t capacity() const
Definition: SmallVector.h:99
iterator begin()
Definition: SmallVector.h:272
T * iterator
Definition: SmallVector.h:256
const_reference back() const
Definition: SmallVector.h:317
const T & const_reference
Definition: SmallVector.h:263
size_t size_type
Definition: SmallVector.h:253
reference operator[](size_type idx)
Definition: SmallVector.h:295
size_t capacity_in_bytes() const
Definition: SmallVector.h:288
const_reverse_iterator rend() const
Definition: SmallVector.h:281
std::reverse_iterator< iterator > reverse_iterator
Definition: SmallVector.h:260
const_iterator end() const
Definition: SmallVector.h:275
bool isSmall() const
Return true if this is a smallvector which has not had dynamic memory allocated for it.
Definition: SmallVector.h:148
T value_type
Definition: SmallVector.h:255
iterator end()
Definition: SmallVector.h:274
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:234
void assertSafeToAddRange(ItTy, ItTy)
Definition: SmallVector.h:229
SmallVectorTemplateCommon(size_t Size)
Definition: SmallVector.h:140
void assertSafeToAddRange(const T *From, const T *To)
Check whether any part of the range will be invalidated by growing.
Definition: SmallVector.h:219
const_reference front() const
Definition: SmallVector.h:308
T & reference
Definition: SmallVector.h:262
const T * const_iterator
Definition: SmallVector.h:257
T * pointer
Definition: SmallVector.h:264
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:201
bool isSafeToReferenceAfterResize(const void *Elt, size_t NewSize)
Return true unless Elt will be invalidated by resizing the vector to NewSize.
Definition: SmallVector.h:179
void assertSafeToReferenceAfterResize(const void *Elt, size_t NewSize)
Check whether Elt will be invalidated by resizing the vector to NewSize.
Definition: SmallVector.h:193
bool empty() const
Definition: SmallVector.h:101
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:170
reference back()
Definition: SmallVector.h:313
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:157
void assertSafeToReferenceAfterClear(ItTy, ItTy)
Definition: SmallVector.h:216
size_type max_size() const
Definition: SmallVector.h:284
void grow_pod(size_t MinSize, size_t TSize)
Definition: SmallVector.h:142
reverse_iterator rend()
Definition: SmallVector.h:280
A range adaptor for a pair of iterators.
Definition: iterator_range.h:42
IteratorT begin() const
Definition: iterator_range.h:63
typename std::enable_if< B, T >::type enable_if_t
Definition: core.h:256
typename std::remove_const< T >::type remove_const_t
Definition: core.h:263
typename std::remove_reference< T >::type remove_reference_t
Definition: core.h:261
auto copy(const Range &range, OutputIt out) -> OutputIt
Definition: ranges.h:26
FMT_CONSTEXPR auto fill_n(OutputIt out, Size count, const T &value) -> OutputIt
Definition: format.h:622
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
static constexpr const unit_t< compound_unit< energy::joules, inverse< temperature::kelvin >, inverse< substance::moles > > > R(8.3144598)
Gas constant.
UnitTypeLhs() max(const UnitTypeLhs &lhs, const UnitTypeRhs &rhs)
Definition: base.h:3417
UnitTypeLhs() min(const UnitTypeLhs &lhs, const UnitTypeRhs &rhs)
Definition: base.h:3409
Definition: ntcore_cpp.h:26
iterator_range(Container &&) -> iterator_range< 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:1305
SmallVector< Out, Size > to_vector_of(R &&Range)
Definition: SmallVector.h:1314
Helper class for calculating the default number of inline elements for SmallVector<T>.
Definition: SmallVector.h:1135
Figure out the offset of the first element.
Definition: SmallVector.h:115
char Base[sizeof(SmallVectorBase)]
Definition: SmallVector.h:117
char FirstEl[sizeof(T)]
Definition: SmallVector.h:118
Storage for the SmallVector elements.
Definition: SmallVector.h:1116
std::enable_if_t< std::is_convertible< typename std::iterator_traits< Iterator >::iterator_category, std::input_iterator_tag >::value > EnableIfConvertibleToInputIterator
Definition: SmallVector.h:49
std::remove_const_t< std::remove_reference_t< decltype(*std::begin(std::declval< RangeType & >()))> > ValueTypeFromRangeType
Definition: SmallVector.h:1299
#define S(label, offset, message)
Definition: Errors.h:119