LLVM  16.0.0git
Public Member Functions | List of all members
llvm::SmallVector< T, N > Class Template Reference

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small. More...

#include "llvm/ADT/SmallVector.h"

Inherits llvm::SmallVectorImpl< T >, and llvm::SmallVectorStorage< T, CalculateSmallVectorDefaultInlinedElements< T >::value >.

Collaboration diagram for llvm::SmallVector< T, N >:
Collaboration graph
[legend]

Public Member Functions

 SmallVector ()
 
 ~SmallVector ()
 
 SmallVector (size_t Size, const T &Value=T())
 
template<typename ItTy , typename = EnableIfConvertibleToInputIterator<ItTy>>
 SmallVector (ItTy S, ItTy E)
 
template<typename RangeTy >
 SmallVector (const iterator_range< RangeTy > &R)
 
 SmallVector (std::initializer_list< T > IL)
 
template<typename U , typename = std::enable_if_t<std::is_convertible<U, T>::value>>
 SmallVector (ArrayRef< U > A)
 
 SmallVector (const SmallVector &RHS)
 
SmallVectoroperator= (const SmallVector &RHS)
 
 SmallVector (SmallVector &&RHS)
 
 SmallVector (SmallVectorImpl< T > &&RHS)
 
SmallVectoroperator= (SmallVector &&RHS)
 
SmallVectoroperator= (SmallVectorImpl< T > &&RHS)
 
SmallVectoroperator= (std::initializer_list< T > IL)
 
- Public Member Functions inherited from llvm::SmallVectorImpl< T >
 SmallVectorImpl (const SmallVectorImpl &)=delete
 
 ~SmallVectorImpl ()
 
void clear ()
 
void resize (size_type N)
 
void resize_for_overwrite (size_type N)
 Like resize, but T is POD, the new values won't be initialized. More...
 
void truncate (size_type N)
 Like resize, but requires that N is less than size(). More...
 
void resize (size_type N, ValueParamT NV)
 
void reserve (size_type N)
 
void pop_back_n (size_type NumItems)
 
T pop_back_val ()
 
void swap (SmallVectorImpl &RHS)
 
template<typename ItTy , typename = EnableIfConvertibleToInputIterator<ItTy>>
void append (ItTy in_start, ItTy in_end)
 Add the specified range to the end of the SmallVector. More...
 
void append (size_type NumInputs, ValueParamT Elt)
 Append NumInputs copies of Elt to the end. More...
 
void append (std::initializer_list< T > IL)
 
void append (const SmallVectorImpl &RHS)
 
void assign (size_type NumElts, ValueParamT Elt)
 
template<typename ItTy , typename = EnableIfConvertibleToInputIterator<ItTy>>
void assign (ItTy in_start, ItTy in_end)
 
void assign (std::initializer_list< T > IL)
 
void assign (const SmallVectorImpl &RHS)
 
iterator erase (const_iterator CI)
 
iterator erase (const_iterator CS, const_iterator CE)
 
iterator insert (iterator I, T &&Elt)
 
iterator insert (iterator I, const T &Elt)
 
iterator insert (iterator I, size_type NumToInsert, ValueParamT Elt)
 
template<typename ItTy , typename = EnableIfConvertibleToInputIterator<ItTy>>
iterator insert (iterator I, ItTy From, ItTy To)
 
void insert (iterator I, std::initializer_list< T > IL)
 
template<typename... ArgTypes>
reference emplace_back (ArgTypes &&... Args)
 
SmallVectorImploperator= (const SmallVectorImpl &RHS)
 
SmallVectorImploperator= (SmallVectorImpl &&RHS)
 
bool operator== (const SmallVectorImpl &RHS) const
 
bool operator!= (const SmallVectorImpl &RHS) const
 
bool operator< (const SmallVectorImpl &RHS) const
 
bool operator> (const SmallVectorImpl &RHS) const
 
bool operator<= (const SmallVectorImpl &RHS) const
 
bool operator>= (const SmallVectorImpl &RHS) const
 

Additional Inherited Members

- Public Types inherited from llvm::SmallVectorImpl< T >
using iterator = typename SuperClass::iterator
 
using const_iterator = typename SuperClass::const_iterator
 
using reference = typename SuperClass::reference
 
using size_type = typename SuperClass::size_type
 
- Protected Types inherited from llvm::SmallVectorImpl< T >
using ValueParamT = typename SuperClass::ValueParamT
 
- Protected Member Functions inherited from llvm::SmallVectorImpl< T >
 SmallVectorImpl (unsigned N)
 
void assignRemote (SmallVectorImpl &&RHS)
 

Detailed Description

template<typename T, unsigned N = CalculateSmallVectorDefaultInlinedElements<T>::value>
class llvm::SmallVector< T, N >

This is a 'vector' (really, 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.

Note
In the absence of a well-motivated choice for the number of inlined elements N, it is recommended to use SmallVector<T> (that is, omitting the N). This will choose a default number of inlined elements reasonable for allocation on the stack (for example, trying to keep sizeof(SmallVector<T>) around 64 bytes).
Warning
This does not attempt to be exception safe.
See also
https://llvm.org/docs/ProgrammersManual.html#llvm-adt-smallvector-h

Definition at line 1199 of file SmallVector.h.

Constructor & Destructor Documentation

◆ SmallVector() [1/9]

template<typename T , unsigned N = CalculateSmallVectorDefaultInlinedElements<T>::value>
llvm::SmallVector< T, N >::SmallVector ( )
inline

Definition at line 1202 of file SmallVector.h.

◆ ~SmallVector()

template<typename T , unsigned N = CalculateSmallVectorDefaultInlinedElements<T>::value>
llvm::SmallVector< T, N >::~SmallVector ( )
inline

Definition at line 1204 of file SmallVector.h.

◆ SmallVector() [2/9]

template<typename T , unsigned N = CalculateSmallVectorDefaultInlinedElements<T>::value>
llvm::SmallVector< T, N >::SmallVector ( size_t  Size,
const T Value = T() 
)
inlineexplicit

Definition at line 1209 of file SmallVector.h.

◆ SmallVector() [3/9]

template<typename T , unsigned N = CalculateSmallVectorDefaultInlinedElements<T>::value>
template<typename ItTy , typename = EnableIfConvertibleToInputIterator<ItTy>>
llvm::SmallVector< T, N >::SmallVector ( ItTy  S,
ItTy  E 
)
inline

Definition at line 1215 of file SmallVector.h.

◆ SmallVector() [4/9]

template<typename T , unsigned N = CalculateSmallVectorDefaultInlinedElements<T>::value>
template<typename RangeTy >
llvm::SmallVector< T, N >::SmallVector ( const iterator_range< RangeTy > &  R)
inlineexplicit

Definition at line 1220 of file SmallVector.h.

◆ SmallVector() [5/9]

template<typename T , unsigned N = CalculateSmallVectorDefaultInlinedElements<T>::value>
llvm::SmallVector< T, N >::SmallVector ( std::initializer_list< T IL)
inline

Definition at line 1225 of file SmallVector.h.

◆ SmallVector() [6/9]

template<typename T , unsigned N = CalculateSmallVectorDefaultInlinedElements<T>::value>
template<typename U , typename = std::enable_if_t<std::is_convertible<U, T>::value>>
llvm::SmallVector< T, N >::SmallVector ( ArrayRef< U >  A)
inlineexplicit

Definition at line 1231 of file SmallVector.h.

◆ SmallVector() [7/9]

template<typename T , unsigned N = CalculateSmallVectorDefaultInlinedElements<T>::value>
llvm::SmallVector< T, N >::SmallVector ( const SmallVector< T, N > &  RHS)
inline

Definition at line 1235 of file SmallVector.h.

◆ SmallVector() [8/9]

template<typename T , unsigned N = CalculateSmallVectorDefaultInlinedElements<T>::value>
llvm::SmallVector< T, N >::SmallVector ( SmallVector< T, N > &&  RHS)
inline

Definition at line 1245 of file SmallVector.h.

◆ SmallVector() [9/9]

template<typename T , unsigned N = CalculateSmallVectorDefaultInlinedElements<T>::value>
llvm::SmallVector< T, N >::SmallVector ( SmallVectorImpl< T > &&  RHS)
inline

Definition at line 1250 of file SmallVector.h.

Member Function Documentation

◆ operator=() [1/4]

template<typename T , unsigned N = CalculateSmallVectorDefaultInlinedElements<T>::value>
SmallVector& llvm::SmallVector< T, N >::operator= ( const SmallVector< T, N > &  RHS)
inline

Definition at line 1240 of file SmallVector.h.

◆ operator=() [2/4]

template<typename T , unsigned N = CalculateSmallVectorDefaultInlinedElements<T>::value>
SmallVector& llvm::SmallVector< T, N >::operator= ( SmallVector< T, N > &&  RHS)
inline

Definition at line 1255 of file SmallVector.h.

◆ operator=() [3/4]

template<typename T , unsigned N = CalculateSmallVectorDefaultInlinedElements<T>::value>
SmallVector& llvm::SmallVector< T, N >::operator= ( SmallVectorImpl< T > &&  RHS)
inline

Definition at line 1273 of file SmallVector.h.

◆ operator=() [4/4]

template<typename T , unsigned N = CalculateSmallVectorDefaultInlinedElements<T>::value>
SmallVector& llvm::SmallVector< T, N >::operator= ( std::initializer_list< T IL)
inline

Definition at line 1278 of file SmallVector.h.


The documentation for this class was generated from the following file: