Blender
V3.3
|
#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::Array< T, InlineBufferCapacity, Allocator > |
Namespaces | |
blender | |
Typedefs | |
template<typename T , int64_t InlineBufferCapacity = default_inline_buffer_capacity(sizeof(T))> | |
using | blender::RawArray = Array< T, InlineBufferCapacity, RawAllocator > |
A blender::Array<T>
is a container for a fixed size array the size of which is NOT known at compile time.
If the size is known at compile time, std::array<T, N>
should be used instead.
blender::Array should usually be used instead of blender::Vector whenever the number of elements is known at construction time. Note however, that blender::Array will default construct all elements when initialized with the size-constructor. For trivial types, this does nothing. In all other cases, this adds overhead.
A main benefit of using Array over Vector is that it expresses the intent of the developer better. It indicates that the size of the data structure is not expected to change. Furthermore, you can be more certain that an array does not over-allocate.
blender::Array supports small object optimization to improve performance when the size turns out to be small at run-time.
Definition in file BLI_array.hh.