|
Blender V4.3
|
#include "BLI_allocator.hh"#include "BLI_bit_bool_conversion.hh"#include "BLI_bit_span.hh"#include "BLI_span.hh"Go to the source code of this file.
Classes | |
| class | blender::bits::BitVector< InlineBufferCapacity, Allocator > |
Namespaces | |
| namespace | blender |
| namespace | blender::bits |
Functions | |
| template<int64_t InlineBufferCapacity, typename Allocator > | |
| BoundedBitSpan | blender::bits::to_best_bit_span (const BitVector< InlineBufferCapacity, Allocator > &data) |
| template<int64_t InlineBufferCapacity, typename Allocator > | |
| MutableBoundedBitSpan | blender::bits::to_best_bit_span (BitVector< InlineBufferCapacity, Allocator > &data) |
A blender::BitVector is a dynamically growing contiguous arrays of bits. Its main purpose is to provide a compact way to map indices to bools. It requires 8 times less memory compared to a blender::Vector<bool>.
Advantages of using a bit- instead of byte-vector are:
The compact nature of storing bools in individual bits has some downsides that have to be kept in mind:
Comparison to std::vector<bool>:
blender::BitVector has an interface that is more optimized for dealing with bits.blender::BitVector has an inline buffer that is used to avoid allocations when the vector is small.Comparison to BLI_bitmap:
blender::BitVector offers a more C++ friendly interface.BLI_bitmap should only be used in C code that can not use blender::BitVector. Definition in file BLI_bit_vector.hh.