#include <Containers/SmallVector.h>
template<typename T>
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
-
template<typename T, bool = std::class SmallVectorTemplate
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.
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
ifv
is an internal reference to the given range. - auto isReferenceToStorage(const void* v) const -> bool
- Return
true
ifv
is an internal reference to this vector. - auto isRangeInStorage(const void* first, const void* last) const -> bool
- Returns
true
iffirst
andlast
form a valid (possibly empty) range in this vector's storage. -
auto isSafeToReferenceAfterResize(const void* elt,
std::
size_t newSize) -> bool - Returns
true
unlesselt
will be invalidated by resizing the vector tonewSize
. -
void assertSafeToReferenceAfterResize(const void* elt,
std::
size_t newSize) - Checks whether
elt
will be invalidated by resizing the vector tonewSize
. -
void assertSafeToAdd(const void* elt,
std::
size_t n = 1) - Checks whether
elt
will be invalidated by increasing the size of the vector byn
. - void assertSafeToReferenceAfterClear(const T* from, const T* to)
- Checks whether any part of the range will be invalidated by clearing.
-
template<class ItTy, std::void assertSafeToReferenceAfterClear(ItTy, ItTy)
enable_if_t<!std:: is_same<std:: remove_const_t<ItTy>, T*>::value, int> = 0> - void assertSafeToAddRange(const T* from, const T* to)
- Checks whether any part of the range will be invalidated by growing.
-
template<class ItTy, std::void assertSafeToAddRange(ItTy, ItTy)
enable_if_t<!std:: is_same<std:: remove_const_t<ItTy>, T*>::value, int> = 0>
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.