LLVM  13.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 = std::enable_if_t<std::is_convertible< typename std::iterator_traits<ItTy>::iterator_category, std::input_iterator_tag>::value>>
 SmallVector (ItTy S, ItTy E)
 
template<typename RangeTy >
 SmallVector (const iterator_range< RangeTy > &R)
 
 SmallVector (std::initializer_list< T > IL)
 
 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 resize (size_type N, ValueParamT NV)
 
void reserve (size_type N)
 
void pop_back_n (size_type NumItems)
 
LLVM_NODISCARDpop_back_val ()
 
void swap (SmallVectorImpl &RHS)
 
template<typename in_iter , typename = std::enable_if_t<std::is_convertible< typename std::iterator_traits<in_iter>::iterator_category, std::input_iterator_tag>::value>>
void append (in_iter in_start, in_iter 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 in_iter , typename = std::enable_if_t<std::is_convertible< typename std::iterator_traits<in_iter>::iterator_category, std::input_iterator_tag>::value>>
void assign (in_iter in_start, in_iter 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 = std::enable_if_t<std::is_convertible< typename std::iterator_traits<ItTy>::iterator_category, std::input_iterator_tag>::value>>
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
 

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)
 

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 1168 of file SmallVector.h.

Constructor & Destructor Documentation

◆ SmallVector() [1/8]

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

Definition at line 1171 of file SmallVector.h.

◆ ~SmallVector()

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

Definition at line 1173 of file SmallVector.h.

◆ SmallVector() [2/8]

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

Definition at line 1178 of file SmallVector.h.

◆ SmallVector() [3/8]

template<typename T , unsigned N = CalculateSmallVectorDefaultInlinedElements<T>::value>
template<typename ItTy , typename = std::enable_if_t<std::is_convertible< typename std::iterator_traits<ItTy>::iterator_category, std::input_iterator_tag>::value>>
llvm::SmallVector< T, N >::SmallVector ( ItTy  S,
ItTy  E 
)
inline

Definition at line 1187 of file SmallVector.h.

◆ SmallVector() [4/8]

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 1192 of file SmallVector.h.

◆ SmallVector() [5/8]

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

Definition at line 1197 of file SmallVector.h.

◆ SmallVector() [6/8]

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

Definition at line 1201 of file SmallVector.h.

◆ SmallVector() [7/8]

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

Definition at line 1211 of file SmallVector.h.

◆ SmallVector() [8/8]

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

Definition at line 1216 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 1206 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 1221 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 1226 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 1231 of file SmallVector.h.


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