Blender V5.0
blender::VectorList< T, CapacityStart, CapacityMax > Class Template Reference

#include <BLI_vector_list.hh>

Public Member Functions

 VectorList ()
 VectorList (VectorList &&other) noexcept
VectorListoperator= (VectorList &&other)
void append (const T &value)
void append (T &&value)
template<typename ForwardT>
void append_as (ForwardT &&value)
Tfirst ()
Tlast ()
int64_t size () const
bool is_empty () const
void clear ()
void clear_and_shrink ()
const Toperator[] (int64_t index) const
Toperator[] (int64_t index)
MutIterator begin ()
MutIterator end ()
ConstIterator begin () const
ConstIterator end () const

Detailed Description

template<typename T, int64_t CapacityStart = 32, int64_t CapacityMax = 4096>
class blender::VectorList< T, CapacityStart, CapacityMax >

A VectorList is a vector of vectors.

VectorList can be used when:

1) Don't know up front the number of elements that will be added to the list. Use array or vector.reserve when known up front.

2) Number of reads/writes doesn't require sequential access of the whole list. A vector ensures memory is sequential which is fast when reading, writing can have overhead when the reserved memory is full.

When a VectorList reserved memory is full it will allocate memory for the new items, breaking the sequential access. Within each allocated memory block the elements are ordered sequentially.

Indexing has some overhead compared to a Vector or an Array, but it still has constant time access.

Definition at line 38 of file BLI_vector_list.hh.

Constructor & Destructor Documentation

◆ VectorList() [1/2]

template<typename T, int64_t CapacityStart = 32, int64_t CapacityMax = 4096>
blender::VectorList< T, CapacityStart, CapacityMax >::VectorList ( )
inline

Definition at line 54 of file BLI_vector_list.hh.

◆ VectorList() [2/2]

template<typename T, int64_t CapacityStart = 32, int64_t CapacityMax = 4096>
blender::VectorList< T, CapacityStart, CapacityMax >::VectorList ( VectorList< T, CapacityStart, CapacityMax > && other)
inlinenoexcept

Definition at line 60 of file BLI_vector_list.hh.

Member Function Documentation

◆ append() [1/2]

◆ append() [2/2]

template<typename T, int64_t CapacityStart = 32, int64_t CapacityMax = 4096>
void blender::VectorList< T, CapacityStart, CapacityMax >::append ( T && value)
inline

Insert a new element at the end of the VectorList.

Definition at line 80 of file BLI_vector_list.hh.

◆ append_as()

template<typename T, int64_t CapacityStart = 32, int64_t CapacityMax = 4096>
template<typename ForwardT>
void blender::VectorList< T, CapacityStart, CapacityMax >::append_as ( ForwardT && value)
inline

This is similar to std::vector::emplace_back.

Definition at line 86 of file BLI_vector_list.hh.

Referenced by blender::VectorList< DupliObject >::append(), and blender::VectorList< DupliObject >::append().

◆ begin() [1/2]

template<typename T, int64_t CapacityStart = 32, int64_t CapacityMax = 4096>
MutIterator blender::VectorList< T, CapacityStart, CapacityMax >::begin ( )
inline

Definition at line 284 of file BLI_vector_list.hh.

◆ begin() [2/2]

template<typename T, int64_t CapacityStart = 32, int64_t CapacityMax = 4096>
ConstIterator blender::VectorList< T, CapacityStart, CapacityMax >::begin ( ) const
inline

Definition at line 293 of file BLI_vector_list.hh.

◆ clear()

template<typename T, int64_t CapacityStart = 32, int64_t CapacityMax = 4096>
void blender::VectorList< T, CapacityStart, CapacityMax >::clear ( )
inline

Afterwards the VectorList has 0 elements, but will still have memory to be refilled again.

Definition at line 130 of file BLI_vector_list.hh.

Referenced by BKE_scene_base_iter_next(), blender::draw::foreach_obref_in_scene(), blender::tests::TEST(), and blender::tests::TEST().

◆ clear_and_shrink()

template<typename T, int64_t CapacityStart = 32, int64_t CapacityMax = 4096>
void blender::VectorList< T, CapacityStart, CapacityMax >::clear_and_shrink ( )
inline

Afterwards the VectorList has 0 elements and the Vectors allocated memory will be freed.

Definition at line 140 of file BLI_vector_list.hh.

◆ end() [1/2]

template<typename T, int64_t CapacityStart = 32, int64_t CapacityMax = 4096>
MutIterator blender::VectorList< T, CapacityStart, CapacityMax >::end ( )
inline

Definition at line 288 of file BLI_vector_list.hh.

◆ end() [2/2]

template<typename T, int64_t CapacityStart = 32, int64_t CapacityMax = 4096>
ConstIterator blender::VectorList< T, CapacityStart, CapacityMax >::end ( ) const
inline

Definition at line 297 of file BLI_vector_list.hh.

◆ first()

template<typename T, int64_t CapacityStart = 32, int64_t CapacityMax = 4096>
T & blender::VectorList< T, CapacityStart, CapacityMax >::first ( )
inline

Return a reference to the first element in the VectorList. This invokes undefined behavior when the VectorList is empty.

Definition at line 97 of file BLI_vector_list.hh.

Referenced by BKE_scene_base_iter_next(), and blender::tests::TEST().

◆ is_empty()

template<typename T, int64_t CapacityStart = 32, int64_t CapacityMax = 4096>
bool blender::VectorList< T, CapacityStart, CapacityMax >::is_empty ( ) const
inline

Returns true when the VectorList contains no elements, otherwise false.

This is the same as std::vector::empty.

Definition at line 124 of file BLI_vector_list.hh.

Referenced by BKE_scene_base_iter_next(), BM_mesh_uvselect_set_elem_from_mesh(), blender::draw::foreach_obref_in_scene(), blender::ed::object::make_object_duplilist_real(), and blender::tests::TEST().

◆ last()

template<typename T, int64_t CapacityStart = 32, int64_t CapacityMax = 4096>
T & blender::VectorList< T, CapacityStart, CapacityMax >::last ( )
inline

Return a reference to the last element in the VectorList. This invokes undefined behavior when the VectorList is empty.

Definition at line 107 of file BLI_vector_list.hh.

Referenced by make_dupli(), blender::tests::TEST(), blender::tests::TEST(), and blender::tests::TEST().

◆ operator=()

template<typename T, int64_t CapacityStart = 32, int64_t CapacityMax = 4096>
VectorList & blender::VectorList< T, CapacityStart, CapacityMax >::operator= ( VectorList< T, CapacityStart, CapacityMax > && other)
inline

Definition at line 68 of file BLI_vector_list.hh.

◆ operator[]() [1/2]

template<typename T, int64_t CapacityStart = 32, int64_t CapacityMax = 4096>
T & blender::VectorList< T, CapacityStart, CapacityMax >::operator[] ( int64_t index)
inline

Get the value at the given index. This invokes undefined behavior when the index is out of bounds.

Definition at line 162 of file BLI_vector_list.hh.

◆ operator[]() [2/2]

template<typename T, int64_t CapacityStart = 32, int64_t CapacityMax = 4096>
const T & blender::VectorList< T, CapacityStart, CapacityMax >::operator[] ( int64_t index) const
inline

Get the value at the given index. This invokes undefined behavior when the index is out of bounds.

Definition at line 152 of file BLI_vector_list.hh.

◆ size()


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