14#ifndef WPIUTIL_WPI_SMALLVECTOR_H
15#define WPIUTIL_WPI_SMALLVECTOR_H
22#pragma GCC diagnostic warning "-Wclass-memaccess"
33#include <initializer_list>
43template <
typename IteratorT>
class iterator_range;
65 :
BeginX(FirstEl),
Capacity(static_cast<unsigned>(TotalCapacity)) {}
75 void grow_pod(
void *FirstEl,
size_t MinSize,
size_t TSize);
90 Size =
static_cast<unsigned>(N);
104template <
typename T,
typename =
void>
112 void *getFirstEl()
const {
113 return const_cast<void *
>(
reinterpret_cast<const void *
>(
114 reinterpret_cast<const char *
>(
this) +
132 this->
BeginX = getFirstEl();
139 std::less<> LessThan;
140 return !LessThan(V, First) && LessThan(V, Last);
152 std::less<> LessThan;
153 return !LessThan(First, this->
begin()) && !LessThan(Last, First) &&
154 !LessThan(this->
end(), Last);
165 if (NewSize <= this->
size())
166 return Elt < this->
begin() + NewSize;
175 "Attempting to reference an element of the vector in an operation "
176 "that invalidates it");
194 std::enable_if_t<!std::is_same<std::remove_const_t<ItTy>, T *>
::value,
207 std::enable_if_t<!std::is_same<std::remove_const_t<ItTy>, T *>
::value,
216 size_t NewSize = This->size() + N;
220 bool ReferencesStorage =
false;
222 if (!U::TakesParamByValue) {
224 ReferencesStorage =
true;
225 Index = &Elt - This->begin();
229 return ReferencesStorage ? This->begin() +
Index : &Elt;
276 assert(idx <
size());
280 assert(idx <
size());
311template <
typename T,
bool = (is_trivially_copy_constructible<T>::value) &&
312 (is_trivially_move_constructible<T>::value) &&
313 std::is_trivially_destructible<T>::value>
332 template<
typename It1,
typename It2>
334 std::uninitialized_copy(std::make_move_iterator(I),
335 std::make_move_iterator(E), Dest);
340 template<
typename It1,
typename It2>
342 std::uninitialized_copy(I, E, Dest);
353 return static_cast<T *
>(
355 MinSize,
sizeof(T), NewCapacity));
374 return const_cast<T *
>(
385 std::uninitialized_fill_n(NewElts, NumElts, Elt);
395 ::new ((
void *)(NewElts + this->
size())) T(std::forward<ArgTypes>(Args)...);
405 ::new ((
void *)this->
end()) T(*EltPtr);
411 ::new ((
void *)this->
end()) T(::std::move(*EltPtr));
422template <
typename T,
bool TriviallyCopyable>
425 T *NewElts = mallocForGrow(MinSize, NewCapacity);
426 moveElementsForGrow(NewElts);
427 takeAllocationForGrow(NewElts, NewCapacity);
431template <
typename T,
bool TriviallyCopyable>
435 this->uninitialized_move(this->
begin(), this->
end(), NewElts);
438 destroy_range(this->
begin(), this->
end());
442template <
typename T,
bool TriviallyCopyable>
444 T *NewElts,
size_t NewCapacity) {
446 if (!this->isSmall())
449 this->BeginX = NewElts;
450 this->Capacity =
static_cast<unsigned>(NewCapacity);
478 template<
typename It1,
typename It2>
486 template<
typename It1,
typename It2>
489 std::uninitialized_copy(I, E, Dest);
494 template <
typename T1,
typename T2>
496 T1 *I, T1 *E, T2 *Dest,
504 memcpy(
reinterpret_cast<void *
>(Dest), I, (E - I) *
sizeof(T));
520 return const_cast<T *
>(
532 std::uninitialized_fill_n(this->
begin(), NumElts, Elt);
540 push_back(T(std::forward<ArgTypes>(Args)...));
547 memcpy(
reinterpret_cast<void *
>(this->
end()), EltPtr,
sizeof(T));
578 this->
BeginX = RHS.BeginX;
579 this->
Size = RHS.Size;
603 template <
bool ForOverwrite>
void resizeImpl(
size_type N) {
604 if (N == this->
size())
607 if (N < this->
size()) {
613 for (
auto I = this->
end(), E = this->
begin() + N; I != E; ++I)
629 assert(this->
size() >= N &&
"Cannot increase size with truncate");
635 if (N == this->
size())
638 if (N < this->
size()) {
653 assert(this->
size() >= NumItems);
658 T Result = ::std::move(this->
back());
666 template <
typename in_iter,
668 typename std::iterator_traits<in_iter>::iterator_category,
669 std::input_iterator_tag>
::value>>
670 void append(in_iter in_start, in_iter in_end) {
672 size_type NumInputs = std::distance(in_start, in_end);
681 std::uninitialized_fill_n(this->
end(), NumInputs, *EltPtr);
685 void append(std::initializer_list<T> IL) {
686 append(IL.begin(), IL.end());
700 if (NumElts > this->
size())
701 std::uninitialized_fill_n(this->
end(), NumElts - this->
size(), Elt);
702 else if (NumElts < this->
size())
710 template <
typename in_iter,
712 typename std::iterator_traits<in_iter>::iterator_category,
713 std::input_iterator_tag>
::value>>
714 void assign(in_iter in_start, in_iter in_end) {
720 void assign(std::initializer_list<T> IL) {
735 std::move(I+1, this->
end(), I);
758 template <
class ArgType>
iterator insert_one_impl(
iterator I, ArgType &&Elt) {
761 std::is_same<std::remove_const_t<std::remove_reference_t<ArgType>>,
763 "ArgType must be derived from T!");
765 if (I == this->
end()) {
766 this->
push_back(::std::forward<ArgType>(Elt));
767 return this->
end()-1;
774 std::remove_reference_t<ArgType> *EltPtr =
778 ::new ((
void*) this->
end()) T(::
std::move(this->
back()));
780 std::move_backward(I, this->
end()-1, this->
end());
786 "ArgType must be 'T' when taking
by value!");
790 *I = ::
std::forward<ArgType>(*EltPtr);
805 size_t InsertElt = I - this->
begin();
807 if (I == this->
end()) {
809 return this->
begin()+InsertElt;
819 I = this->
begin()+InsertElt;
825 if (
size_t(this->
end()-I) >= NumToInsert) {
826 T *OldEnd = this->
end();
827 append(std::move_iterator<iterator>(this->
end() - NumToInsert),
828 std::move_iterator<iterator>(this->
end()));
831 std::move_backward(I, OldEnd-NumToInsert, OldEnd);
836 EltPtr += NumToInsert;
846 T *OldEnd = this->
end();
848 size_t NumOverwritten = OldEnd-I;
854 EltPtr += NumToInsert;
860 std::uninitialized_fill_n(OldEnd, NumToInsert - NumOverwritten, *EltPtr);
864 template <
typename ItTy,
866 typename std::iterator_traits<ItTy>::iterator_category,
867 std::input_iterator_tag>
::value>>
870 size_t InsertElt = I - this->
begin();
872 if (I == this->
end()) {
874 return this->
begin()+InsertElt;
882 size_t NumToInsert = std::distance(From, To);
888 I = this->
begin()+InsertElt;
894 if (
size_t(this->
end()-I) >= NumToInsert) {
895 T *OldEnd = this->
end();
896 append(std::move_iterator<iterator>(this->
end() - NumToInsert),
897 std::move_iterator<iterator>(this->
end()));
900 std::move_backward(I, OldEnd-NumToInsert, OldEnd);
910 T *OldEnd = this->
end();
912 size_t NumOverwritten = OldEnd-I;
916 for (T *J = I; NumOverwritten > 0; --NumOverwritten) {
927 insert(I, IL.begin(), IL.end());
934 ::new ((
void *)this->
end()) T(std::forward<ArgTypes>(Args)...);
944 if (this->
size() != RHS.
size())
return false;
948 return !(*
this == RHS);
952 return std::lexicographical_compare(this->
begin(), this->
end(),
959 if (
this == &RHS)
return;
972 size_t NumShared = this->
size();
973 if (NumShared > RHS.
size()) NumShared = RHS.
size();
974 for (
size_type i = 0; i != NumShared; ++i)
979 size_t EltDiff = this->
size() - RHS.
size();
984 }
else if (RHS.
size() > this->size()) {
985 size_t EltDiff = RHS.
size() - this->
size();
997 if (
this == &RHS)
return *
this;
1001 size_t RHSSize = RHS.
size();
1002 size_t CurSize = this->
size();
1003 if (CurSize >= RHSSize) {
1009 NewEnd = this->
begin();
1026 this->
grow(RHSSize);
1027 }
else if (CurSize) {
1034 this->begin()+CurSize);
1041template <
typename T>
1044 if (
this == &RHS)
return *
this;
1047 if (!RHS.isSmall()) {
1054 size_t RHSSize = RHS.size();
1055 size_t CurSize = this->
size();
1056 if (CurSize >= RHSSize) {
1060 NewEnd = std::move(RHS.begin(), RHS.end(), NewEnd);
1080 this->
grow(RHSSize);
1081 }
else if (CurSize) {
1083 std::move(RHS.begin(), RHS.begin()+CurSize, this->begin());
1088 this->begin()+CurSize);
1099template <
typename T,
unsigned N>
1101 alignas(T)
char InlineElts[N *
sizeof(T)];
1127 static constexpr size_t kPreferredSmallVectorSizeof = 64;
1153 "You are trying to use a default number of inlined elements for "
1154 "`SmallVector<T>` but `sizeof(T)` is really big! Please use an "
1155 "explicit number of inlined elements with `SmallVector<T, N>` to make "
1156 "sure you really want that much inline storage.");
1160 static constexpr size_t PreferredInlineBytes =
1162 static constexpr size_t NumElementsThatFit = PreferredInlineBytes /
sizeof(T);
1164 NumElementsThatFit == 0 ? 1 : NumElementsThatFit;
1183template <
typename T,
1197 this->
assign(Size, Value);
1200 template <
typename ItTy,
1202 typename std::iterator_traits<ItTy>::iterator_category,
1203 std::input_iterator_tag>
::value>>
1208 template <
typename RangeTy>
1267template <
typename T,
unsigned N>
1272template <
typename RangeType>
1274 typename std::remove_const<
typename std::remove_reference<
1280template <
unsigned Size,
typename R>
1284template <
typename R>
1285SmallVector<ValueTypeFromRangeType<R>,
1286 CalculateSmallVectorDefaultInlinedElements<
1287 ValueTypeFromRangeType<R>>
::value>
1297 template<
typename T>
1304 template<
typename T,
unsigned N>
#define LLVM_UNLIKELY(EXPR)
Definition: Compiler.h:250
#define LLVM_GSL_OWNER
LLVM_GSL_OWNER - Apply this to owning classes like SmallVector to enable lifetime warnings.
Definition: Compiler.h:338
#define LLVM_NODISCARD
LLVM_NODISCARD - Warn if a type or return value is discarded.
Definition: Compiler.h:177
#define LLVM_LIKELY(EXPR)
Definition: Compiler.h:249
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:143
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:292
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:154
This is all the stuff common to all SmallVectors.
Definition: SmallVector.h:53
void * BeginX
Definition: SmallVector.h:55
size_t size() const
Definition: SmallVector.h:78
unsigned Capacity
Definition: SmallVector.h:56
unsigned Size
Definition: SmallVector.h:56
LLVM_NODISCARD bool empty() const
Definition: SmallVector.h:81
size_t capacity() const
Definition: SmallVector.h:79
static constexpr size_t SizeTypeMax()
The maximum value of the Size_T used.
Definition: SmallVector.h:59
void * mallocForGrow(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 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:64
void set_size(size_t N)
Set the array size to N, which the current array must have enough capacity for.
Definition: SmallVector.h:88
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1186
SmallVector(ItTy S, ItTy E)
Definition: SmallVector.h:1204
SmallVector(const iterator_range< RangeTy > &R)
Definition: SmallVector.h:1209
~SmallVector()
Definition: SmallVector.h:1190
SmallVector(std::initializer_list< T > IL)
Definition: SmallVector.h:1214
SmallVector(SmallVectorImpl< T > &&RHS)
Definition: SmallVector.h:1233
SmallVector & operator=(SmallVectorImpl< T > &&RHS)
Definition: SmallVector.h:1256
SmallVector()
Definition: SmallVector.h:1188
SmallVector(const SmallVector &RHS)
Definition: SmallVector.h:1218
SmallVector(size_t Size, const T &Value=T())
Definition: SmallVector.h:1195
SmallVector & operator=(SmallVector &&RHS)
Definition: SmallVector.h:1238
SmallVector & operator=(const SmallVector &RHS)
Definition: SmallVector.h:1223
SmallVector(SmallVector &&RHS)
Definition: SmallVector.h:1228
SmallVector & operator=(std::initializer_list< T > IL)
Definition: SmallVector.h:1261
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:557
bool operator!=(const SmallVectorImpl &RHS) const
Definition: SmallVector.h:947
SmallVectorImpl & operator=(SmallVectorImpl &&RHS)
Definition: SmallVector.h:1042
void assign(in_iter in_start, in_iter in_end)
Definition: SmallVector.h:714
iterator erase(const_iterator CI)
Definition: SmallVector.h:727
~SmallVectorImpl()
Definition: SmallVector.h:587
reference emplace_back(ArgTypes &&... Args)
Definition: SmallVector.h:930
void resize_for_overwrite(size_type N)
Like resize, but T is POD, the new values won't be initialized.
Definition: SmallVector.h:625
void assign(std::initializer_list< T > IL)
Definition: SmallVector.h:720
void append(std::initializer_list< T > IL)
Definition: SmallVector.h:685
iterator insert(iterator I, ItTy From, ItTy To)
Definition: SmallVector.h:868
bool operator==(const SmallVectorImpl &RHS) const
Definition: SmallVector.h:943
SmallVectorImpl(unsigned N)
Definition: SmallVector.h:571
SmallVectorImpl & operator=(const SmallVectorImpl &RHS)
Definition: SmallVector.h:995
void clear()
Definition: SmallVector.h:594
void assignRemote(SmallVectorImpl &&RHS)
Definition: SmallVector.h:574
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
Definition: SmallVector.h:670
typename SuperClass::size_type size_type
Definition: SmallVector.h:564
void swap(SmallVectorImpl &RHS)
Definition: SmallVector.h:958
iterator insert(iterator I, T &&Elt)
Definition: SmallVector.h:795
void reserve(size_type N)
Definition: SmallVector.h:647
void assign(const SmallVectorImpl &RHS)
Definition: SmallVector.h:725
void truncate(size_type N)
Like resize, but requires that N is less than size().
Definition: SmallVector.h:628
typename SuperClass::iterator iterator
Definition: SmallVector.h:561
bool operator<(const SmallVectorImpl &RHS) const
Definition: SmallVector.h:951
void assign(size_type NumElts, ValueParamT Elt)
Definition: SmallVector.h:691
iterator insert(iterator I, size_type NumToInsert, ValueParamT Elt)
Definition: SmallVector.h:803
void append(const SmallVectorImpl &RHS)
Definition: SmallVector.h:689
SmallVectorImpl(const SmallVectorImpl &)=delete
void resize(size_type N, ValueParamT NV)
Definition: SmallVector.h:634
void pop_back_n(size_type NumItems)
Definition: SmallVector.h:652
LLVM_NODISCARD T pop_back_val()
Definition: SmallVector.h:657
void insert(iterator I, std::initializer_list< T > IL)
Definition: SmallVector.h:926
void append(size_type NumInputs, ValueParamT Elt)
Append NumInputs copies of Elt to the end.
Definition: SmallVector.h:679
void resize(size_type N)
Definition: SmallVector.h:622
iterator insert(iterator I, const T &Elt)
Definition: SmallVector.h:799
iterator erase(const_iterator CS, const_iterator CE)
Definition: SmallVector.h:741
static void uninitialized_copy(T1 *I, T1 *E, T2 *Dest, std::enable_if_t< std::is_same< typename std::remove_const< T1 >::type, T2 >::value > *=nullptr)
Copy the range [I, E) onto the uninitialized memory starting with "Dest", constructing elements into ...
Definition: SmallVector.h:495
void growAndAssign(size_t NumElts, T Elt)
Definition: SmallVector.h:527
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:513
static ValueParamT forward_value_param(ValueParamT V)
Copy V or return a reference, depending on ValueParamT.
Definition: SmallVector.h:525
static void destroy_range(T *, T *)
Definition: SmallVector.h:474
SmallVectorTemplateBase(size_t Size)
Definition: SmallVector.h:471
T & growAndEmplaceBack(ArgTypes &&... Args)
Definition: SmallVector.h:536
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:509
typename std::conditional< TakesParamByValue, T, const T & >::type ValueParamT
Either const T& or T, depending on whether it's cheap enough to take parameters by value.
Definition: SmallVector.h:469
void push_back(ValueParamT Elt)
Definition: SmallVector.h:545
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:487
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:519
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:479
void pop_back()
Definition: SmallVector.h:551
SmallVectorTemplateBase<TriviallyCopyable = false> - This is where we put method implementations that...
Definition: SmallVector.h:314
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:333
void moveElementsForGrow(T *NewElts)
Move existing elements over to the new allocation NewElts, the middle section of grow().
Definition: SmallVector.h:432
SmallVectorTemplateBase(size_t Size)
Definition: SmallVector.h:321
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:341
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:373
const T & ValueParamT
Definition: SmallVector.h:319
void pop_back()
Definition: SmallVector.h:415
static const T & forward_value_param(const T &V)
Definition: SmallVector.h:379
static void destroy_range(T *S, T *E)
Definition: SmallVector.h:323
void takeAllocationForGrow(T *NewElts, size_t NewCapacity)
Transfer ownership of the allocation, finishing up grow().
Definition: SmallVector.h:443
static T && forward_value_param(T &&V)
Definition: SmallVector.h:378
static constexpr bool TakesParamByValue
Definition: SmallVector.h:318
void push_back(T &&Elt)
Definition: SmallVector.h:409
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:352
void grow(size_t MinSize=0)
Grow the allocated memory (without initializing new elements), doubling the size of the allocated mem...
Definition: SmallVector.h:423
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:367
T & growAndEmplaceBack(ArgTypes &&... Args)
Definition: SmallVector.h:391
void push_back(const T &Elt)
Definition: SmallVector.h:403
void growAndAssign(size_t NumElts, const T &Elt)
Definition: SmallVector.h:381
This is the part of SmallVectorTemplateBase which does not depend on whether the type T is a POD.
Definition: SmallVector.h:106
ptrdiff_t difference_type
Definition: SmallVector.h:234
const T * const_pointer
Definition: SmallVector.h:245
void assertSafeToReferenceAfterClear(const T *From, const T *To)
Check whether any part of the range will be invalidated by clearing.
Definition: SmallVector.h:186
reverse_iterator rbegin()
Definition: SmallVector.h:258
const_iterator begin() const
Definition: SmallVector.h:253
reference front()
Definition: SmallVector.h:284
size_t size() const
Definition: SmallVector.h:78
size_type size_in_bytes() const
Definition: SmallVector.h:263
void resetToSmall()
Put this vector in a state of being small.
Definition: SmallVector.h:131
const_reverse_iterator rbegin() const
Definition: SmallVector.h:259
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: SmallVector.h:239
const_reference operator[](size_type idx) const
Definition: SmallVector.h:279
bool isReferenceToStorage(const void *V) const
Return true if V is an internal reference to this vector.
Definition: SmallVector.h:144
LLVM_NODISCARD bool empty() const
Definition: SmallVector.h:81
const_pointer data() const
Return a pointer to the vector's buffer, even if empty().
Definition: SmallVector.h:273
pointer data()
Return a pointer to the vector's buffer, even if empty().
Definition: SmallVector.h:271
size_t capacity() const
Definition: SmallVector.h:79
iterator begin()
Definition: SmallVector.h:252
T * iterator
Definition: SmallVector.h:236
const_reference back() const
Definition: SmallVector.h:297
const T & const_reference
Definition: SmallVector.h:243
size_t size_type
Definition: SmallVector.h:233
reference operator[](size_type idx)
Definition: SmallVector.h:275
size_t capacity_in_bytes() const
Definition: SmallVector.h:268
const_reverse_iterator rend() const
Definition: SmallVector.h:261
std::reverse_iterator< iterator > reverse_iterator
Definition: SmallVector.h:240
const_iterator end() const
Definition: SmallVector.h:255
bool isSmall() const
Return true if this is a smallvector which has not had dynamic memory allocated for it.
Definition: SmallVector.h:128
T value_type
Definition: SmallVector.h:235
iterator end()
Definition: SmallVector.h:254
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:214
void assertSafeToAddRange(ItTy, ItTy)
Definition: SmallVector.h:209
SmallVectorTemplateCommon(size_t Size)
Definition: SmallVector.h:120
void assertSafeToAddRange(const T *From, const T *To)
Check whether any part of the range will be invalidated by growing.
Definition: SmallVector.h:199
const_reference front() const
Definition: SmallVector.h:288
T & reference
Definition: SmallVector.h:242
const T * const_iterator
Definition: SmallVector.h:237
T * pointer
Definition: SmallVector.h:244
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:181
bool isSafeToReferenceAfterResize(const void *Elt, size_t NewSize)
Return true unless Elt will be invalidated by resizing the vector to NewSize.
Definition: SmallVector.h:159
void assertSafeToReferenceAfterResize(const void *Elt, size_t NewSize)
Check whether Elt will be invalidated by resizing the vector to NewSize.
Definition: SmallVector.h:173
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:150
reference back()
Definition: SmallVector.h:293
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:137
void assertSafeToReferenceAfterClear(ItTy, ItTy)
Definition: SmallVector.h:196
size_type max_size() const
Definition: SmallVector.h:264
void grow_pod(size_t MinSize, size_t TSize)
Definition: SmallVector.h:122
reverse_iterator rend()
Definition: SmallVector.h:260
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
IteratorT begin() const
Definition: iterator_range.h:44
typename std::enable_if< B, T >::type enable_if_t
Definition: core.h:298
type
Definition: core.h:575
constexpr common_t< T1, T2 > max(const T1 x, const T2 y) noexcept
Compile-time pairwise maximum function.
Definition: max.hpp:35
constexpr common_t< T1, T2 > min(const T1 x, const T2 y) noexcept
Compile-time pairwise minimum function.
Definition: min.hpp:35
::int64_t int64_t
Definition: Meta.h:59
static EIGEN_DEPRECATED const end_t end
Definition: IndexedViewHelper.h:181
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
OutputIterator copy(const RangeT &range, OutputIterator out)
Definition: ranges.h:26
FMT_CONSTEXPR auto fill_n(OutputIt out, Size count, const T &value) -> OutputIt
Definition: format.h:560
GHC_FS_API directory_iterator begin(directory_iterator iter) noexcept
Definition: filesystem.hpp:5746
Definition: StdDeque.h:50
void swap(wpi::SmallVectorImpl< T > &LHS, wpi::SmallVectorImpl< T > &RHS)
Implement std::swap in terms of SmallVector swap.
Definition: SmallVector.h:1299
static constexpr const unit_t< compound_unit< energy::joules, inverse< temperature::kelvin >, inverse< substance::moles > > > R(8.3144598)
Gas constant.
/file This file defines the SmallVector class.
Definition: AprilTagFieldLayout.h:18
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:1281
typename std::remove_const< typename std::remove_reference< decltype(*std::begin(std::declval< RangeType & >()))>::type >::type ValueTypeFromRangeType
Definition: SmallVector.h:1275
Helper class for calculating the default number of inline elements for SmallVector<T>.
Definition: SmallVector.h:1119
Figure out the offset of the first element.
Definition: SmallVector.h:95
char Base[sizeof(SmallVectorBase)]
Definition: SmallVector.h:97
char FirstEl[sizeof(T)]
Definition: SmallVector.h:98
Storage for the SmallVector elements.
Definition: SmallVector.h:1100
#define S(label, offset, message)
Definition: Errors.h:118