Back to Taskflow

template<typename T, unsigned N = 2> tf::SmallVector class

docs/classtf_1_1SmallVector.html

4.0.02.8 KB
Original Source

template<typename T, unsigned N = 2> tf::SmallVector class

class to define a vector optimized for small array

Template parameters
T
N

The class defines a C++ STL-styled vector (a variable-sized array) optimized for the case when the array is small. It contains some number of elements in-place, which allows it to avoid heap allocation when the actual number of elements is below that threshold. This allows normal small cases to be fast without losing generality for large inputs. All the methods in std::vector can apply to this class.

The class is stripped from the LLVM codebase.

Constructors, destructors, conversion operators

SmallVector()constructs an empty vectorSmallVector(size_t Size, const T& Value = T()) explicit constructs a vector with Size copies of elements with value value template<typename ItTy> SmallVector(ItTy S, ItTy E)constructs a vector with the contents of the range [S, E)SmallVector(std::initializer_list<T> IL)constructs a vector with the contents of the initializer list ILSmallVector(const SmallVector& RHS)constructs the vector with the copy of the contents of RHSSmallVector(SmallVector&& RHS)constructs the vector with the contents of RHS using move semanticsSmallVector(SmallVectorImpl<T>&& RHS)constructs a vector with the contents of RHS using move semantics

Public functions

auto operator=(const SmallVector& RHS) -> const SmallVector&replaces the contents with a copy of the contents of RHSauto operator=(SmallVector&& RHS) -> const SmallVector&replaces the contents with the contents of RHS using move semanticsauto operator=(SmallVectorImpl<T>&& RHS) -> const SmallVector&replaces the contents with the contents of RHS using move semanticsauto operator=(std::initializer_list<T> IL) -> const SmallVector&replaces the contents with the copy of the contents of an initializer list IL