template<typename T>
Death::Containers::SmallVectorTemplateCommon class

Common template of SmallVector which does not depend on whether the type is trivial or not.

Template parameters
T Element type

Base classes

template<class SizeT>
class SmallVectorBase<SmallVectorSizeType<T>>
Base class of SmallVector.

Derived classes

class SmallVectorTemplate
Template method specializations of SmallVector depending on whether type is trivial or not.

Public types

using size_type = std::size_t
Size type.
using difference_type = std::ptrdiff_t
Difference type.
using value_type = T
Value type.
using iterator = T*
Iterator type.
using const_iterator = const T*
Const iterator type.
using const_reverse_iterator = std::reverse_iterator<const_iterator>
Const reverse iterator type.
using reverse_iterator = std::reverse_iterator<iterator>
Reverse iterator type.
using reference = T&
Reference type.
using const_reference = const T&
Const reference type.
using pointer = T*
Pointer type.
using const_pointer = const T*
Const pointer type.

Constructors, destructors, conversion operators

SmallVectorTemplateCommon(std::size_t size) protected

Public functions

auto begin() -> iterator
Returns an iterator to the beginning.
auto begin() const -> const_iterator
auto end() -> iterator
Returns an iterator to the end.
auto end() const -> const_iterator
auto rbegin() -> reverse_iterator
Returns a reverse iterator to the beginning.
auto rbegin() const -> const_reverse_iterator
auto rend() -> reverse_iterator
Returns a reverse iterator to the end.
auto rend() const -> const_reverse_iterator
auto size_in_bytes() const -> size_type
Returns total size in bytes.
auto max_size() const -> size_type
Returns maximum number of elements.
auto capacity_in_bytes() const -> std::size_t
Returns capacity in bytes.
auto data() -> pointer
Returns a pointer to the vector's buffer.
auto data() const -> const_pointer
auto operator[](size_type idx) -> reference
Access specified element.
auto operator[](size_type idx) const -> const_reference
auto front() -> reference
Access the first element.
auto front() const -> const_reference
auto back() -> reference
Access the last element.
auto back() const -> const_reference
auto capacity() const -> std::size_t
Returns the number of elements that can be held in currently allocated storage.
auto empty() const -> bool
Returns whether the container is empty.
auto size() const -> std::size_t
Returns the number of elements.

Protected static functions

template<class U>
static auto reserveForParamAndGetAddressImpl(U* _this, const T& elt, std::size_t n) -> const T*
Reserves enough space to add one element, and return the updated element pointer in case it was a reference to the storage.

Protected functions

auto getFirstElement() const -> void*
Finds the address of the first element.
void growTrivial(std::size_t minSize, std::size_t typeSize)
Grows the allocated memory (without initializing new elements) for trivial types.
auto isSmall() const -> bool
Returns true if this is a vector which has not had dynamic memory allocated for it.
void resetToSmall()
Puts this vector in a state of being small.
auto isReferenceToRange(const void* v, const void* first, const void* last) const -> bool
Returns true if v is an internal reference to the given range.
auto isReferenceToStorage(const void* v) const -> bool
Return true if v is an internal reference to this vector.
auto isRangeInStorage(const void* first, const void* last) const -> bool
Returns true if first and last form a valid (possibly empty) range in this vector's storage.
auto isSafeToReferenceAfterResize(const void* elt, std::size_t newSize) -> bool
Returns true unless elt will be invalidated by resizing the vector to newSize.
void assertSafeToReferenceAfterResize(const void* elt, std::size_t newSize)
Checks whether elt will be invalidated by resizing the vector to newSize.
void assertSafeToAdd(const void* elt, std::size_t n = 1)
Checks whether elt will be invalidated by increasing the size of the vector by n.
void assertSafeToReferenceAfterClear(const T* from, const T* to)
Checks whether any part of the range will be invalidated by clearing.
template<class ItTy, std::enable_if_t<!std::is_same<std::remove_const_t<ItTy>, T*>::value, int> = 0>
void assertSafeToReferenceAfterClear(ItTy, ItTy)
void assertSafeToAddRange(const T* from, const T* to)
Checks whether any part of the range will be invalidated by growing.
template<class ItTy, std::enable_if_t<!std::is_same<std::remove_const_t<ItTy>, T*>::value, int> = 0>
void assertSafeToAddRange(ItTy, ItTy)

Function documentation

template<typename T>
const_iterator Death::Containers::SmallVectorTemplateCommon<T>::begin() const

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>
const_iterator Death::Containers::SmallVectorTemplateCommon<T>::end() const

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>
const_reverse_iterator Death::Containers::SmallVectorTemplateCommon<T>::rbegin() const

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>
const_reverse_iterator Death::Containers::SmallVectorTemplateCommon<T>::rend() const

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>
const_pointer Death::Containers::SmallVectorTemplateCommon<T>::data() const

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>
const_reference Death::Containers::SmallVectorTemplateCommon<T>::operator[](size_type idx) const

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>
const_reference Death::Containers::SmallVectorTemplateCommon<T>::front() const

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>
const_reference Death::Containers::SmallVectorTemplateCommon<T>::back() const

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::SmallVectorTemplateCommon<T>::getFirstElement() const protected

Finds the address of the first element.

For this pointer math to be valid with small-size of 0 for T with lots of alignment, it's important that SmallVectorStorage is properly-aligned even for small-size of 0

template<typename T> template<class ItTy, std::enable_if_t<!std::is_same<std::remove_const_t<ItTy>, T*>::value, int> = 0>
void Death::Containers::SmallVectorTemplateCommon<T>::assertSafeToReferenceAfterClear(ItTy, ItTy) protected

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<class ItTy, std::enable_if_t<!std::is_same<std::remove_const_t<ItTy>, T*>::value, int> = 0>
void Death::Containers::SmallVectorTemplateCommon<T>::assertSafeToAddRange(ItTy, ItTy) protected

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.