Template Class SmallVectorTemplateBase

Inheritance Relationships

Base Type

Derived Types

Class Documentation

template<typename T, bool = (std::is_trivially_copy_constructible<T>::value)&&(std::is_trivially_move_constructible<T>::value)&&std::is_trivially_destructible<T>::value>
class SmallVectorTemplateBase : public ams::SmallVectorTemplateCommon<T>

SmallVectorTemplateBase<TriviallyCopyable = false> - This is where we put method implementations that are designed to work with non-trivial T’s.

We approximate is_trivially_copyable with trivial move/copy construction and trivial destruction. While the standard doesn’t specify that you’re allowed copy these types with memcpy, there is no way for the type to observe this. This catches the important case of std::pair<POD, POD>, which is not trivially assignable.

Subclassed by ams::SmallVectorImpl< IntDimType >, ams::SmallVectorImpl< T >

Public Functions

inline void push_back(const T &Elt)
inline void push_back(T &&Elt)
inline void pop_back()

Protected Types

using ValueParamT = const T&

Protected Functions

inline SmallVectorTemplateBase(size_t Size)
void grow(size_t MinSize = 0)

Grow the allocated memory (without initializing new elements), doubling the size of the allocated memory. Guarantees space for at least one more element, or MinSize more elements if specified.

T *mallocForGrow(size_t MinSize, size_t &NewCapacity)

Create a new allocation big enough for MinSize and pass back its size in NewCapacity. This is the first section of grow().

void moveElementsForGrow(T *NewElts)

Move existing elements over to the new allocation NewElts, the middle section of grow().

void takeAllocationForGrow(T *NewElts, size_t NewCapacity)

Transfer ownership of the allocation, finishing up grow().

inline 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 reference to the storage.

inline 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 reference to the storage.

inline void growAndAssign(size_t NumElts, const T &Elt)
template<typename ...ArgTypes>
inline T &growAndEmplaceBack(ArgTypes&&... Args)

Protected Static Functions

static inline void destroy_range(T *S, T *E)
template<typename It1, typename It2>
static inline void uninitialized_move(It1 I, It1 E, It2 Dest)

Move the range [I, E) into the uninitialized memory starting with “Dest”, constructing elements as needed. We expose a C++14 API, so we cannot directly call uninitialized_move that was intorduced on C++17. This is equivalent.

template<typename It1, typename It2>
static inline void uninitialized_copy(It1 I, It1 E, It2 Dest)

Copy the range [I, E) onto the uninitialized memory starting with “Dest”, constructing elements as needed.

static inline T &&forward_value_param(T &&V)
static inline const T &forward_value_param(const T &V)

Protected Static Attributes

static constexpr bool TakesParamByValue = false