|
Blender V4.3
|
#include <algorithm>#include "BLI_allocator.hh"#include "BLI_index_range.hh"#include "BLI_memory_utils.hh"#include "BLI_span.hh"#include "BLI_utildefines.h"Go to the source code of this file.
Classes | |
| class | blender::Vector< T, InlineBufferCapacity, Allocator > |
Namespaces | |
| namespace | blender |
| namespace | blender::internal |
Macros | |
| #define | UPDATE_VECTOR_SIZE(ptr) (ptr)->debug_size_ = int64_t((ptr)->end_ - (ptr)->begin_) |
Typedefs | |
| template<typename T , int64_t InlineBufferCapacity = default_inline_buffer_capacity(sizeof(T))> | |
| using | blender::RawVector = Vector<T, InlineBufferCapacity, RawAllocator> |
Functions | |
| void | blender::internal::vector_print_stats (const char *name, const void *address, int64_t size, int64_t capacity, int64_t inlineCapacity, int64_t memorySize) |
A blender::Vector<T> is a dynamically growing contiguous array for values of type T. It is designed to be a more convenient and efficient replacement for std::vector. Note that the term "vector" has nothing to do with a vector from computer graphics here.
A vector supports efficient insertion and removal at the end (O(1) amortized). Removal in other places takes O(n) time, because all elements afterwards have to be moved. If the order of elements is not important, remove_and_reorder can be used instead of remove for better performance.
The improved efficiency is mainly achieved by supporting small buffer optimization. As long as the number of elements in the vector does not become larger than InlineBufferCapacity, no memory allocation is done. As a consequence, iterators are invalidated when a blender::Vector is moved (iterators of std::vector remain valid when the vector is moved).
blender::Vector should be your default choice for a vector data structure in Blender.
Definition in file BLI_vector.hh.
Definition at line 101 of file BLI_vector.hh.
Referenced by blender::Vector< T, InlineBufferCapacity, Allocator >::append_unchecked_as(), blender::Vector< T, InlineBufferCapacity, Allocator >::clear(), blender::Vector< T, InlineBufferCapacity, Allocator >::clear_and_shrink(), blender::Vector< T, InlineBufferCapacity, Allocator >::extend_unchecked(), blender::Vector< T, InlineBufferCapacity, Allocator >::increase_size_by_unchecked(), blender::Vector< T, InlineBufferCapacity, Allocator >::insert(), blender::Vector< T, InlineBufferCapacity, Allocator >::pop_last(), blender::Vector< T, InlineBufferCapacity, Allocator >::remove(), blender::Vector< T, InlineBufferCapacity, Allocator >::remove(), blender::Vector< T, InlineBufferCapacity, Allocator >::remove_and_reorder(), blender::Vector< T, InlineBufferCapacity, Allocator >::remove_if(), blender::Vector< T, InlineBufferCapacity, Allocator >::remove_last(), blender::Vector< T, InlineBufferCapacity, Allocator >::resize(), blender::Vector< T, InlineBufferCapacity, Allocator >::resize(), and blender::Vector< T, InlineBufferCapacity, Allocator >::Vector().