#include <Containers/SmallVector.h>
template<typename T>
SmallVectorImpl class
Common method implementations of SmallVector class to reduce code duplication based on N
template parameter.
Template parameters | |
---|---|
T | Element type |
Base classes
-
template<typename T, bool = std::class SmallVectorTemplate<T>
is_trivially_copy_constructible<T>::value&& std:: is_trivially_move_constructible<T>::value&& std:: is_trivially_destructible<T>::value> - Template method specializations of SmallVector depending on whether type is trivial or not.
Derived classes
-
template<typename T, unsigned N = CalculateSmallVectorDefaultInlinedElements<T>::value>class SmallVector
- Memory-optimized vector.
Public types
-
using iterator = typename BaseClass::
iterator - Iterator type.
-
using const_iterator = typename BaseClass::
const_iterator - Const iterator type.
-
using reference = typename BaseClass::
reference - Reference type.
-
using size_type = typename BaseClass::
size_type - Size type.
Constructors, destructors, conversion operators
- SmallVectorImpl(unsigned n) protected explicit
- ~SmallVectorImpl() protected
- SmallVectorImpl(const SmallVectorImpl&) deleted
Public functions
- void clear()
- Clears the vector.
-
void resize(size_
type n) - Resizes the vector to given size, value-initializing new elements.
-
void resize_for_overwrite(size_
type n) - Resizes the vector to given size, default-initializing new elements.
-
void resize(size_
type n, ValueParamT nv) - Resizes the vector to given size, constructing new elements using provided argument.
-
void truncate(size_
type n) - Like resize, but requires that
n
is less than size() -
void reserve(size_
type n) - Reserve given capacity in the vector.
-
void pop_back_n(size_
type n) - Removes the last
n
elements. - auto pop_back_val() -> T
- Removes the last element and returns it.
- void swap(SmallVectorImpl& other)
- Swaps the contents.
-
template<typename in_iter, std::void append(in_iter inStart, in_iter inEnd)
enable_if_t<std:: is_convertible<typename std:: iterator_traits<in_iter>::iterator_category, std:: input_iterator_tag>::value, int> = 0> - Adds the specified range to the end of the vector.
-
void append(size_
type n, ValueParamT elt) - Appends
n
copies ofelt
to the end. -
void append(std::
initializer_list<T> il) - Appends the specified list to the end.
- void append(const SmallVectorImpl& other)
- Appends the specified vector to the end.
-
void assign(size_
type n, ValueParamT elt) - Assigns
n
copies ofelt
. -
template<typename in_iter, std::void assign(in_iter inStart, in_iter inEnd)
enable_if_t<std:: is_convertible<typename std:: iterator_traits<in_iter>::iterator_category, std:: input_iterator_tag>::value, int> = 0> - Assigns the specified range.
-
void assign(std::
initializer_list<T> il) - Assigns the specified list.
- void assign(const SmallVectorImpl& other)
- Assigns the specified vector.
-
auto erase(const_
iterator ci) -> iterator - Removes elements from the vector.
-
auto erase(const_
iterator cs, const_ iterator ce) -> iterator -
void erase(size_
type index) -
auto eraseUnordered(const_
iterator ci) -> iterator - Removes an element from the unordered vector.
-
void eraseUnordered(size_
type index) - auto insert(iterator i, T&& elt) -> iterator
- Inserts elements.
- auto insert(iterator i, const T& elt) -> iterator
-
auto insert(iterator i,
size_
type numToInsert, ValueParamT elt) -> iterator -
template<typename ItTy, std::auto insert(iterator i, ItTy from, ItTy to) -> iterator
enable_if_t<std:: is_convertible<typename std:: iterator_traits<ItTy>::iterator_category, std:: input_iterator_tag>::value, int> = 0> -
void insert(iterator i,
std::
initializer_list<T> il) -
template<typename ... ArgTypes>auto emplace_back(ArgTypes && ... args) -> reference
- Constructs elements in-place at the end.
- auto operator=(const SmallVectorImpl& other) -> SmallVectorImpl&
- auto operator=(SmallVectorImpl&& other) -> SmallVectorImpl&
- auto operator==(const SmallVectorImpl& other) const -> bool
- auto operator!=(const SmallVectorImpl& other) const -> bool
- auto operator<(const SmallVectorImpl& other) const -> bool
- auto operator>(const SmallVectorImpl& other) const -> bool
- auto operator<=(const SmallVectorImpl& other) const -> bool
- auto operator>=(const SmallVectorImpl& other) const -> bool
Protected types
-
using ValueParamT = typename BaseClass::
ValueParamT - Either
const T&
orT
, depending on whether it's cheap enough to take parameters by value, alwaysconst T&
for non-trivial types.
Function documentation
template<typename T>
iterator Death:: Containers:: SmallVectorImpl<T>:: erase(const_ iterator cs,
const_ iterator ce)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<typename T>
void Death:: Containers:: SmallVectorImpl<T>:: eraseUnordered(size_ type index)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<typename T>
iterator Death:: Containers:: SmallVectorImpl<T>:: insert(iterator i,
size_ type numToInsert,
ValueParamT elt)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<typename T>
template<typename ItTy, std:: enable_if_t<std:: is_convertible<typename std:: iterator_traits<ItTy>::iterator_category, std:: input_iterator_tag>::value, int> = 0>
iterator Death:: Containers:: SmallVectorImpl<T>:: insert(iterator i,
ItTy from,
ItTy to)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<typename T>
void Death:: Containers:: SmallVectorImpl<T>:: insert(iterator i,
std:: initializer_list<T> il)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.