Template Class SmallVectorBase¶
Defined in File SmallVector.hpp
Inheritance Relationships¶
Derived Type¶
public ams::SmallVectorTemplateCommon< IntDimType >(Template Class SmallVectorTemplateCommon)
Class Documentation¶
-
template<class Size_T>
class SmallVectorBase¶ This is all the stuff common to all SmallVectors.
The template parameter specifies the type which should be used to hold the Size and Capacity of the SmallVector, so it can be adjusted. Using 32 bit size is desirable to shrink the size of the SmallVector. Using 64 bit size is desirable for cases like SmallVector<char>, where a 32 bit size would limit the vector to ~4GB. SmallVectors are used for buffering bitcode output - which can exceed 4GB.
Subclassed by ams::SmallVectorTemplateCommon< IntDimType >
Public Functions
-
inline size_t size() const¶
-
inline size_t capacity() const¶
-
inline bool empty() const¶
Protected Functions
-
SmallVectorBase() = delete¶
-
inline SmallVectorBase(void *FirstEl, size_t TotalCapacity)¶
-
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. This function will report a fatal error if it can’t grow at least to
MinSize.
-
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 line to reduce code duplication. This function will report a fatal error if it cannot increase capacity.
-
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, an area unallocated. If a subsequent allocation, that grows the vector, happens to return the same pointer as getFirstEl(), get a new allocation, otherwise isSmall() will falsely return that no allocation was done (true) and the memory will not be freed in the destructor. If a VSize is given (vector size), also copy that many elements to the new allocation - used if realloca fails to increase space, and happens to allocate precisely at BeginX. This is unlikely to be called often, but resolves a memory leak when the situation does occur.
-
inline void set_size(size_t N)¶
Set the array size to
N, which the current array must have enough capacity for.This does not construct or destroy any elements in the vector.
-
inline void set_allocation_range(void *Begin, size_t N)¶
Set the array data pointer to
Beginand capacity toN.This does not construct or destroy any elements in the vector.
Protected Static Functions
-
static inline constexpr size_t SizeTypeMax()¶
The maximum value of the Size_T used.
-
inline size_t size() const¶