#include <Containers/SmallVector.h>
template<typename T, bool = std:: is_trivially_copy_constructible<T>::value&& std:: is_trivially_move_constructible<T>::value&& std:: is_trivially_destructible<T>::value>
SmallVectorTemplate class
Template method specializations of SmallVector depending on whether type is trivial or not.
Template parameters | |
---|---|
T | Element type |
Base classes
-
template<typename T>class SmallVectorTemplateCommon<T>
- Common template of SmallVector which does not depend on whether the type is trivial or not.
Derived classes
-
template<typename T>class SmallVectorImpl
- Common method implementations of SmallVector class to reduce code duplication based on
N
template parameter.
Constructors, destructors, conversion operators
-
SmallVectorTemplate(std::
size_t size) protected
Public functions
Protected types
- using ValueParamT = const T&
- Either
const T&
orT
, depending on whether it's cheap enough to take parameters by value, alwaysconst T&
for non-trivial types.
Protected static functions
- static void destroyRange(T* s, T* e)
- Calls destructor on every element in the specified range if needed.
-
template<typename It1, typename It2>static void uninitializedMove(It1 i, It1 e, It2 dest)
- Moves the range [I, E) into the uninitialized memory starting with
dest
, constructing elements as needed. -
template<typename It1, typename It2>static void uninitializedCopy(It1 i, It1 e, It2 dest)
- Copies the range [I, E) onto the uninitialized memory starting with
dest
, constructing elements as needed. - static auto forwardValueParam(T&& v) -> T&&
- Forwards a value.
- static auto forwardValueParam(const T& v) -> const T&
Protected functions
-
void grow(std::
size_t minSize = 0) - Grows the allocated memory (without initializing new elements), doubling the size of the allocated memory.
-
auto mallocForGrow(std::
size_t minSize, std:: size_t& newCapacity) -> T* - Creates a new allocation big enough for
minSize
and pass back its size innewCapacity
. - void moveElementsForGrow(T* newElts)
- Move existing elements over to the new allocation
newElts
. -
void takeAllocationForGrow(T* newElts,
std::
size_t newCapacity) - Transfers ownership of the allocation.
-
auto reserveForParamAndGetAddress(const T& elt,
std::
size_t n = 1) -> const T* - Reserves enough space to add one element, and returns the updated element pointer in case it was a reference to the storage.
-
auto reserveForParamAndGetAddress(T& elt,
std::
size_t n = 1) -> T* -
void growAndAssign(std::
size_t numElts, const T& elt) - Grows the allocated memory and assigns the specified element.
-
template<typename ... ArgTypes>auto growAndEmplaceBack(ArgTypes && ... args) -> T&
- Grows the allocated memory and emplaces the specified elements back.
Protected static variables
- static bool TakesParamByValue constexpr
- Whether it's cheap enough to take parameters by value, always
false
for non-trivial types.
Function documentation
template<typename T, bool _2>
void Death:: Containers:: SmallVectorTemplate<T, _2>:: push_back(T&& elt)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<typename T, bool _2>
static const T& Death:: Containers:: SmallVectorTemplate<T, _2>:: forwardValueParam(const T& v) protected
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<typename T, bool _2>
T* Death:: Containers:: SmallVectorTemplate<T, _2>:: reserveForParamAndGetAddress(T& elt,
std:: size_t n = 1) protected
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.