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);
120 Capacity =
static_cast<unsigned>(N);
134template <
typename T,
typename =
void>
144 return const_cast<void *
>(
reinterpret_cast<const void *
>(
145 reinterpret_cast<const char *
>(
this) +
169 std::less<> LessThan;
170 return !LessThan(V, First) && LessThan(V, Last);
182 std::less<> LessThan;
183 return !LessThan(First, this->
begin()) && !LessThan(Last, First) &&
184 !LessThan(this->
end(), Last);
195 if (NewSize <= this->
size())
196 return Elt < this->
begin() + NewSize;
205 "Attempting to reference an element of the vector in an operation "
206 "that invalidates it");
224 std::enable_if_t<!std::is_same<std::remove_const_t<ItTy>, T *>::value,
237 std::enable_if_t<!std::is_same<std::remove_const_t<ItTy>, T *>::value,
246 size_t NewSize = This->size() + N;
250 bool ReferencesStorage =
false;
252 if (!U::TakesParamByValue) {
254 ReferencesStorage =
true;
255 Index = &Elt - This->begin();
259 return ReferencesStorage ? This->begin() + Index : &Elt;
306 assert(idx <
size());
310 assert(idx <
size());
341template <
typename T,
bool = (std::is_trivially_copy_constructible<T>::value) &&
342 (std::is_trivially_move_constructible<T>::value) &&
343 std::is_trivially_destructible<T>::value>
362 template<
typename It1,
typename It2>
364 std::uninitialized_move(I, E, Dest);
369 template<
typename It1,
typename It2>
371 std::uninitialized_copy(I, E, Dest);
399 return const_cast<T *
>(
410 std::uninitialized_fill_n(NewElts, NumElts, Elt);
420 ::new ((
void *)(NewElts + this->
size())) T(std::forward<ArgTypes>(Args)...);
430 ::new ((
void *)this->
end()) T(*EltPtr);
436 ::new ((
void *)this->
end()) T(::std::move(*EltPtr));
447template <
typename T,
bool TriviallyCopyable>
450 T *NewElts = mallocForGrow(MinSize, NewCapacity);
451 moveElementsForGrow(NewElts);
452 takeAllocationForGrow(NewElts, NewCapacity);
455template <
typename T,
bool TriviallyCopyable>
457 size_t MinSize,
size_t &NewCapacity) {
458 return static_cast<T *
>(
460 this->getFirstEl(), MinSize,
sizeof(T), NewCapacity));
464template <
typename T,
bool TriviallyCopyable>
468 this->uninitialized_move(this->begin(), this->end(), NewElts);
471 destroy_range(this->begin(), this->end());
475template <
typename T,
bool TriviallyCopyable>
477 T *NewElts,
size_t NewCapacity) {
479 if (!this->isSmall())
482 this->set_allocation_range(NewElts, NewCapacity);
500 using ValueParamT = std::conditional_t<TakesParamByValue, T, const T &>;
509 template<
typename It1,
typename It2>
517 template<
typename It1,
typename It2>
520 std::uninitialized_copy(I, E, Dest);
525 template <
typename T1,
typename T2>
527 T1 *I, T1 *E, T2 *Dest,
535 memcpy(
reinterpret_cast<void *
>(Dest), I, (E - I) *
sizeof(T));
551 return const_cast<T *
>(
563 std::uninitialized_fill_n(this->
begin(), NumElts, Elt);
571 push_back(T(std::forward<ArgTypes>(Args)...));
578 memcpy(
reinterpret_cast<void *
>(this->
end()), EltPtr,
sizeof(T));
609 this->
BeginX = RHS.BeginX;
610 this->
Size = RHS.Size;
634 template <
bool ForOverwrite>
void resizeImpl(
size_type N) {
635 if (N == this->
size())
638 if (N < this->
size()) {
644 for (
auto I = this->
end(), E = this->
begin() + N; I != E; ++I)
660 assert(this->
size() >= N &&
"Cannot increase size with truncate");
666 if (N == this->
size())
669 if (N < this->
size()) {
684 assert(this->
size() >= NumItems);
689 T Result = ::std::move(this->
back());
697 template <
typename ItTy,
typename = EnableIfConvertibleToInputIterator<ItTy>>
698 void append(ItTy in_start, ItTy in_end) {
700 size_type NumInputs = std::distance(in_start, in_end);
709 std::uninitialized_fill_n(this->
end(), NumInputs, *EltPtr);
713 void append(std::initializer_list<T> IL) {
714 append(IL.begin(), IL.end());
728 if (NumElts > this->
size())
729 std::uninitialized_fill_n(this->
end(), NumElts - this->
size(), Elt);
730 else if (NumElts < this->
size())
738 template <
typename ItTy,
typename = EnableIfConvertibleToInputIterator<ItTy>>
739 void assign(ItTy in_start, ItTy in_end) {
745 void assign(std::initializer_list<T> IL) {
760 std::move(I+1, this->
end(), I);
783 template <
class ArgType>
iterator insert_one_impl(
iterator I, ArgType &&Elt) {
786 std::is_same<std::remove_const_t<std::remove_reference_t<ArgType>>,
788 "ArgType must be derived from T!");
790 if (I == this->
end()) {
791 this->
push_back(::std::forward<ArgType>(Elt));
792 return this->
end()-1;
798 size_t Index = I - this->
begin();
799 std::remove_reference_t<ArgType> *EltPtr =
801 I = this->
begin() + Index;
803 ::new ((
void*) this->
end()) T(::
std::move(this->
back()));
805 std::move_backward(I, this->
end()-1, this->
end());
811 "ArgType must be 'T' when taking
by value!");
815 *I = ::
std::forward<ArgType>(*EltPtr);
830 size_t InsertElt = I - this->
begin();
832 if (I == this->
end()) {
834 return this->
begin()+InsertElt;
844 I = this->
begin()+InsertElt;
850 if (
size_t(this->
end()-I) >= NumToInsert) {
851 T *OldEnd = this->
end();
852 append(std::move_iterator<iterator>(this->
end() - NumToInsert),
853 std::move_iterator<iterator>(this->
end()));
856 std::move_backward(I, OldEnd-NumToInsert, OldEnd);
861 EltPtr += NumToInsert;
871 T *OldEnd = this->
end();
873 size_t NumOverwritten = OldEnd-I;
879 EltPtr += NumToInsert;
885 std::uninitialized_fill_n(OldEnd, NumToInsert - NumOverwritten, *EltPtr);
889 template <
typename ItTy,
typename = EnableIfConvertibleToInputIterator<ItTy>>
892 size_t InsertElt = I - this->
begin();
894 if (I == this->
end()) {
896 return this->
begin()+InsertElt;
904 size_t NumToInsert = std::distance(From, To);
910 I = this->
begin()+InsertElt;
916 if (
size_t(this->
end()-I) >= NumToInsert) {
917 T *OldEnd = this->
end();
918 append(std::move_iterator<iterator>(this->
end() - NumToInsert),
919 std::move_iterator<iterator>(this->
end()));
922 std::move_backward(I, OldEnd-NumToInsert, OldEnd);
932 T *OldEnd = this->
end();
934 size_t NumOverwritten = OldEnd-I;
938 for (T *J = I; NumOverwritten > 0; --NumOverwritten) {
949 insert(I, IL.begin(), IL.end());
956 ::new ((
void *)this->
end()) T(std::forward<ArgTypes>(Args)...);
966 if (this->
size() != RHS.
size())
return false;
970 return !(*
this == RHS);
974 return std::lexicographical_compare(this->
begin(), this->
end(),
984 if (
this == &RHS)
return;
997 size_t NumShared = this->
size();
998 if (NumShared > RHS.
size()) NumShared = RHS.
size();
999 for (
size_type i = 0; i != NumShared; ++i)
1004 size_t EltDiff = this->
size() - RHS.
size();
1009 }
else if (RHS.
size() > this->size()) {
1010 size_t EltDiff = RHS.
size() - this->
size();
1018template <
typename T>
1022 if (
this == &RHS)
return *
this;
1026 size_t RHSSize = RHS.
size();
1027 size_t CurSize = this->
size();
1028 if (CurSize >= RHSSize) {
1034 NewEnd = this->
begin();
1051 this->
grow(RHSSize);
1052 }
else if (CurSize) {
1059 this->begin()+CurSize);
1066template <
typename T>
1069 if (
this == &RHS)
return *
this;
1072 if (!RHS.isSmall()) {
1079 size_t RHSSize = RHS.size();
1080 size_t CurSize = this->
size();
1081 if (CurSize >= RHSSize) {
1085 NewEnd = std::move(RHS.begin(), RHS.end(), NewEnd);
1105 this->
grow(RHSSize);
1106 }
else if (CurSize) {
1108 std::move(RHS.begin(), RHS.begin()+CurSize, this->begin());
1113 this->begin()+CurSize);
1124template <
typename T,
unsigned N>
1126 alignas(T)
char InlineElts[N *
sizeof(T)];
1152 static constexpr size_t kPreferredSmallVectorSizeof = 64;
1178 "You are trying to use a default number of inlined elements for "
1179 "`SmallVector<T>` but `sizeof(T)` is really big! Please use an "
1180 "explicit number of inlined elements with `SmallVector<T, N>` to make "
1181 "sure you really want that much inline storage.");
1185 static constexpr size_t PreferredInlineBytes =
1187 static constexpr size_t NumElementsThatFit = PreferredInlineBytes /
sizeof(T);
1188 static constexpr size_t value =
1189 NumElementsThatFit == 0 ? 1 : NumElementsThatFit;
1208template <
typename T,
1227 this->
assign(Size, Value);
1230 template <
typename ItTy,
typename = EnableIfConvertibleToInputIterator<ItTy>>
1235 template <
typename RangeTy>
1245 template <
typename U,
1246 typename = std::enable_if_t<std::is_convertible<U, T>::value>>
1248 this->
append(A.begin(), A.end());
1300template <
typename T,
unsigned N>
1305template <
typename RangeType>
1308 std::declval<RangeType &>()))>>;
1313template <
unsigned Size,
typename R>
1315 return {std::begin(Range), std::end(Range)};
1317template <
typename R>
1319 return {std::begin(Range), std::end(Range)};
1322template <
typename Out,
unsigned Size,
typename R>
1324 return {std::begin(Range), std::end(Range)};
1328 return {std::begin(Range), std::end(Range)};
1331template <
typename T,
typename Pred>
1334 const auto original_size =
c.size();
1335 c.erase(std::remove_if(
c.begin(),
c.end(), pred),
c.end());
1336 return original_size -
c.size();
1344 template<
typename T>
1351 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:341
#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 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:141
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:290
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:152
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 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:101
void set_allocation_range(void *Begin, size_t N)
Set the array data pointer to Begin and capacity to N.
Definition: SmallVector.h:117
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:1211
SmallVector(ItTy S, ItTy E)
Definition: SmallVector.h:1231
SmallVector(std::span< const U > A)
Definition: SmallVector.h:1247
SmallVector(size_t Size, const T &Value)
Definition: SmallVector.h:1225
SmallVector(const iterator_range< RangeTy > &R)
Definition: SmallVector.h:1236
~SmallVector()
Definition: SmallVector.h:1215
SmallVector(std::initializer_list< T > IL)
Definition: SmallVector.h:1241
SmallVector(SmallVectorImpl< T > &&RHS)
Definition: SmallVector.h:1266
SmallVector & operator=(SmallVectorImpl< T > &&RHS)
Definition: SmallVector.h:1289
SmallVector()
Definition: SmallVector.h:1213
SmallVector(size_t Size)
Definition: SmallVector.h:1220
SmallVector(const SmallVector &RHS)
Definition: SmallVector.h:1251
SmallVector & operator=(SmallVector &&RHS)
Definition: SmallVector.h:1271
SmallVector & operator=(const SmallVector &RHS)
Definition: SmallVector.h:1256
SmallVector(SmallVector &&RHS)
Definition: SmallVector.h:1261
SmallVector & operator=(std::initializer_list< T > IL)
Definition: SmallVector.h:1294
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:588
bool operator!=(const SmallVectorImpl &RHS) const
Definition: SmallVector.h:969
SmallVectorImpl & operator=(SmallVectorImpl &&RHS)
Definition: SmallVector.h:1067
iterator erase(const_iterator CI)
Definition: SmallVector.h:752
~SmallVectorImpl()
Definition: SmallVector.h:615
reference emplace_back(ArgTypes &&... Args)
Definition: SmallVector.h:952
void resize_for_overwrite(size_type N)
Like resize, but T is POD, the new values won't be initialized.
Definition: SmallVector.h:656
void assign(std::initializer_list< T > IL)
Definition: SmallVector.h:745
void append(std::initializer_list< T > IL)
Definition: SmallVector.h:713
iterator insert(iterator I, ItTy From, ItTy To)
Definition: SmallVector.h:890
bool operator==(const SmallVectorImpl &RHS) const
Definition: SmallVector.h:965
T pop_back_val()
Definition: SmallVector.h:688
SmallVectorImpl(unsigned N)
Definition: SmallVector.h:602
SmallVectorImpl & operator=(const SmallVectorImpl &RHS)
Definition: SmallVector.h:1020
bool operator>(const SmallVectorImpl &RHS) const
Definition: SmallVector.h:977
void clear()
Definition: SmallVector.h:625
void assignRemote(SmallVectorImpl &&RHS)
Definition: SmallVector.h:605
bool operator<=(const SmallVectorImpl &RHS) const
Definition: SmallVector.h:978
typename SuperClass::size_type size_type
Definition: SmallVector.h:595
void swap(SmallVectorImpl &RHS)
Definition: SmallVector.h:983
iterator insert(iterator I, T &&Elt)
Definition: SmallVector.h:820
void reserve(size_type N)
Definition: SmallVector.h:678
void assign(const SmallVectorImpl &RHS)
Definition: SmallVector.h:750
void truncate(size_type N)
Like resize, but requires that N is less than size().
Definition: SmallVector.h:659
typename SuperClass::iterator iterator
Definition: SmallVector.h:592
bool operator<(const SmallVectorImpl &RHS) const
Definition: SmallVector.h:973
void assign(size_type NumElts, ValueParamT Elt)
Definition: SmallVector.h:719
iterator insert(iterator I, size_type NumToInsert, ValueParamT Elt)
Definition: SmallVector.h:828
void append(const SmallVectorImpl &RHS)
Definition: SmallVector.h:717
SmallVectorImpl(const SmallVectorImpl &)=delete
void resize(size_type N, ValueParamT NV)
Definition: SmallVector.h:665
void pop_back_n(size_type NumItems)
Definition: SmallVector.h:683
void assign(ItTy in_start, ItTy in_end)
Definition: SmallVector.h:739
void insert(iterator I, std::initializer_list< T > IL)
Definition: SmallVector.h:948
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
Definition: SmallVector.h:698
void append(size_type NumInputs, ValueParamT Elt)
Append NumInputs copies of Elt to the end.
Definition: SmallVector.h:707
bool operator>=(const SmallVectorImpl &RHS) const
Definition: SmallVector.h:979
void resize(size_type N)
Definition: SmallVector.h:653
iterator insert(iterator I, const T &Elt)
Definition: SmallVector.h:824
iterator erase(const_iterator CS, const_iterator CE)
Definition: SmallVector.h:766
void growAndAssign(size_t NumElts, T Elt)
Definition: SmallVector.h:558
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:500
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:544
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:526
static ValueParamT forward_value_param(ValueParamT V)
Copy V or return a reference, depending on ValueParamT.
Definition: SmallVector.h:556
static void destroy_range(T *, T *)
Definition: SmallVector.h:505
SmallVectorTemplateBase(size_t Size)
Definition: SmallVector.h:502
T & growAndEmplaceBack(ArgTypes &&... Args)
Definition: SmallVector.h:567
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:540
void push_back(ValueParamT Elt)
Definition: SmallVector.h:576
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:518
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:550
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:510
void pop_back()
Definition: SmallVector.h:582
SmallVectorTemplateBase<TriviallyCopyable = false> - This is where we put method implementations that...
Definition: SmallVector.h:344
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:363
void moveElementsForGrow(T *NewElts)
Move existing elements over to the new allocation NewElts, the middle section of grow().
Definition: SmallVector.h:465
SmallVectorTemplateBase(size_t Size)
Definition: SmallVector.h:351
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:370
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:398
const T & ValueParamT
Definition: SmallVector.h:349
void pop_back()
Definition: SmallVector.h:440
static const T & forward_value_param(const T &V)
Definition: SmallVector.h:404
static void destroy_range(T *S, T *E)
Definition: SmallVector.h:353
void takeAllocationForGrow(T *NewElts, size_t NewCapacity)
Transfer ownership of the allocation, finishing up grow().
Definition: SmallVector.h:476
static T && forward_value_param(T &&V)
Definition: SmallVector.h:403
static constexpr bool TakesParamByValue
Definition: SmallVector.h:348
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:456
void push_back(T &&Elt)
Definition: SmallVector.h:434
void grow(size_t MinSize=0)
Grow the allocated memory (without initializing new elements), doubling the size of the allocated mem...
Definition: SmallVector.h:448
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:392
T & growAndEmplaceBack(ArgTypes &&... Args)
Definition: SmallVector.h:416
void push_back(const T &Elt)
Definition: SmallVector.h:428
void growAndAssign(size_t NumElts, const T &Elt)
Definition: SmallVector.h:406
This is the part of SmallVectorTemplateBase which does not depend on whether the type T is a POD.
Definition: SmallVector.h:136
ptrdiff_t difference_type
Definition: SmallVector.h:264
const T * const_pointer
Definition: SmallVector.h:275
void assertSafeToReferenceAfterClear(const T *From, const T *To)
Check whether any part of the range will be invalidated by clearing.
Definition: SmallVector.h:216
reverse_iterator rbegin()
Definition: SmallVector.h:288
const_iterator begin() const
Definition: SmallVector.h:283
reference front()
Definition: SmallVector.h:314
size_t size() const
Definition: SmallVector.h:98
size_type size_in_bytes() const
Definition: SmallVector.h:293
void resetToSmall()
Put this vector in a state of being small.
Definition: SmallVector.h:161
void * getFirstEl() const
Find the address of the first element.
Definition: SmallVector.h:143
const_reverse_iterator rbegin() const
Definition: SmallVector.h:289
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: SmallVector.h:269
const_reference operator[](size_type idx) const
Definition: SmallVector.h:309
bool isReferenceToStorage(const void *V) const
Return true if V is an internal reference to this vector.
Definition: SmallVector.h:174
const_pointer data() const
Return a pointer to the vector's buffer, even if empty().
Definition: SmallVector.h:303
pointer data()
Return a pointer to the vector's buffer, even if empty().
Definition: SmallVector.h:301
size_t capacity() const
Definition: SmallVector.h:99
iterator begin()
Definition: SmallVector.h:282
T * iterator
Definition: SmallVector.h:266
const_reference back() const
Definition: SmallVector.h:327
const T & const_reference
Definition: SmallVector.h:273
size_t size_type
Definition: SmallVector.h:263
reference operator[](size_type idx)
Definition: SmallVector.h:305
size_t capacity_in_bytes() const
Definition: SmallVector.h:298
const_reverse_iterator rend() const
Definition: SmallVector.h:291
std::reverse_iterator< iterator > reverse_iterator
Definition: SmallVector.h:270
const_iterator end() const
Definition: SmallVector.h:285
bool isSmall() const
Return true if this is a smallvector which has not had dynamic memory allocated for it.
Definition: SmallVector.h:158
T value_type
Definition: SmallVector.h:265
iterator end()
Definition: SmallVector.h:284
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:244
void assertSafeToAddRange(ItTy, ItTy)
Definition: SmallVector.h:239
SmallVectorTemplateCommon(size_t Size)
Definition: SmallVector.h:150
void assertSafeToAddRange(const T *From, const T *To)
Check whether any part of the range will be invalidated by growing.
Definition: SmallVector.h:229
const_reference front() const
Definition: SmallVector.h:318
T & reference
Definition: SmallVector.h:272
const T * const_iterator
Definition: SmallVector.h:267
T * pointer
Definition: SmallVector.h:274
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:211
bool isSafeToReferenceAfterResize(const void *Elt, size_t NewSize)
Return true unless Elt will be invalidated by resizing the vector to NewSize.
Definition: SmallVector.h:189
void assertSafeToReferenceAfterResize(const void *Elt, size_t NewSize)
Check whether Elt will be invalidated by resizing the vector to NewSize.
Definition: SmallVector.h:203
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:180
reference back()
Definition: SmallVector.h:323
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:167
void assertSafeToReferenceAfterClear(ItTy, ItTy)
Definition: SmallVector.h:226
size_type max_size() const
Definition: SmallVector.h:294
void grow_pod(size_t MinSize, size_t TSize)
Definition: SmallVector.h:152
reverse_iterator rend()
Definition: SmallVector.h:290
A range adaptor for a pair of iterators.
Definition: iterator_range.h:42
IteratorT begin() const
Definition: iterator_range.h:62
typename std::enable_if< B, T >::type enable_if_t
Definition: core.h:271
typename std::remove_const< T >::type remove_const_t
Definition: core.h:278
typename std::remove_reference< T >::type remove_reference_t
Definition: core.h:276
auto copy(const Range &range, OutputIt out) -> OutputIt
Definition: ranges.h:22
FMT_CONSTEXPR auto fill_n(OutputIt out, Size count, const T &value) -> OutputIt
Definition: format.h:582
Implement std::hash so that hash_code can be used in STL containers.
Definition: array.h:89
WPI_BASIC_JSON_TPL_DECLARATION void swap(wpi::WPI_BASIC_JSON_TPL &j1, wpi::WPI_BASIC_JSON_TPL &j2) noexcept(//NOLINT(readability-inconsistent-declaration-parameter-name) is_nothrow_move_constructible< wpi::WPI_BASIC_JSON_TPL >::value &&//NOLINT(misc-redundant-expression) is_nothrow_move_assignable< wpi::WPI_BASIC_JSON_TPL >::value)
exchanges the values of two JSON objects
Definition: json.h:5219
static constexpr const unit_t< compound_unit< energy::joules, inverse< temperature::kelvin >, inverse< substance::moles > > > R(8.3144598)
Gas constant.
static constexpr const velocity::meters_per_second_t c(299792458.0)
Speed of light in vacuum.
constexpr UnitTypeLhs() min(const UnitTypeLhs &lhs, const UnitTypeRhs &rhs)
Definition: base.h:3411
constexpr UnitTypeLhs() max(const UnitTypeLhs &lhs, const UnitTypeRhs &rhs)
Definition: base.h:3419
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:1314
SmallVector< Out, Size > to_vector_of(R &&Range)
Definition: SmallVector.h:1323
SmallVectorImpl< T >::size_type erase_if(SmallVectorImpl< T > &c, Pred pred)
Definition: SmallVector.h:1332
Helper class for calculating the default number of inline elements for SmallVector<T>.
Definition: SmallVector.h:1144
Figure out the offset of the first element.
Definition: SmallVector.h:125
char Base[sizeof(SmallVectorBase)]
Definition: SmallVector.h:127
char FirstEl[sizeof(T)]
Definition: SmallVector.h:128
Storage for the SmallVector elements.
Definition: SmallVector.h:1125
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:1308
#define S(label, offset, message)
Definition: Errors.h:119