Blender  V3.3
Classes | Namespaces
BLI_index_mask.hh File Reference
#include "BLI_index_range.hh"
#include "BLI_span.hh"
#include "BLI_vector.hh"

Go to the source code of this file.

Classes

class  blender::IndexMask
 

Namespaces

 blender
 

Detailed Description

An IndexMask references an array of unsigned integers with the following property: The integers must be in ascending order and there must not be duplicates.

Remember that the array is only referenced and not owned by an IndexMask instance.

In most cases the integers in the array represent some indices into another array. So they "select" or "mask" a some elements in that array. Hence the name IndexMask.

The invariant stated above has the nice property that it makes it easy to check if an integer array is an IndexRange, i.e. no indices are skipped. That allows functions to implement two code paths: One where it iterates over the index array and one where it iterates over the index range. The latter one is more efficient due to less memory reads and potential usage of SIMD instructions.

The IndexMask.foreach_index method helps writing code that implements both code paths at the same time.

Definition in file BLI_index_mask.hh.