template<typename T, size_t N = detail::calculateDefaultSmallVectorElems<T>()>
slang::SmallVector class

A concrete, sized version of the SmallVectorBase<T> template.

The template parameter N is the number of elements that will be allocated on the stack.

Base classes

template<typename T>
class SmallVectorBase<T>
Base class for a fast growable array.

Constructors, destructors, conversion operators

SmallVector() noexcept
Default constructs the SmallVector.
SmallVector(size_type capacity, UninitializedTag) explicit
Constructs the SmallVector with the given capacity.
template<std::input_iterator TIter>
SmallVector(TIter first, TIter last)
Constructs the SmallVector from the given range of elements.
template<std::ranges::input_range TRange>
SmallVector(TRange range) explicit
Constructs the SmallVector from the given range.
SmallVector(const SmallVector& other)
Copy constructs from another vector.
SmallVector(const Base& other)
Copy constructs from another vector.
SmallVector(SmallVector&& other)
Move constructs from another vector.
SmallVector(Base&& other)
Move constructs from another vector.

Public functions

auto operator=(const Base& rhs) -> SmallVector&
Copy assignment from another vector.
auto operator=(Base&& rhs) -> SmallVector&
Move assignment from another vector.
void shrink_to_fit()
Requests the removal of unused capacity.

Function documentation

template<typename T, size_t N>
slang::SmallVector<T, N>::SmallVector(size_type capacity, UninitializedTag) explicit

Constructs the SmallVector with the given capacity.

If that capacity is less than the preallocated stack size N it will be ignored. Otherwise it will perform a heap allocation right away. Unlike std::vector this does not add any elements to the container.