diff options
author | Jacques Lucke <mail@jlucke.com> | 2020-02-07 19:23:25 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2020-02-07 19:23:25 +0300 |
commit | c2e80cfaa302e666421a8adee8d2b25a69d0700e (patch) | |
tree | 04340524c5a7de26e84b44f9e2cda75bdebc8fce /source/blender/blenlib/BLI_array_cxx.h | |
parent | f3db5a0965902db622ea291850a1b815eda9d288 (diff) |
BLI: add index_range method to some data structures
This can be used to iterate over all indices with less code.
Diffstat (limited to 'source/blender/blenlib/BLI_array_cxx.h')
-rw-r--r-- | source/blender/blenlib/BLI_array_cxx.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_array_cxx.h b/source/blender/blenlib/BLI_array_cxx.h index c7704e20fb1..e987121d68c 100644 --- a/source/blender/blenlib/BLI_array_cxx.h +++ b/source/blender/blenlib/BLI_array_cxx.h @@ -27,6 +27,7 @@ #include "BLI_allocator.h" #include "BLI_array_ref.h" #include "BLI_memory_utils_cxx.h" +#include "BLI_index_range.h" namespace BLI { @@ -182,6 +183,11 @@ template<typename T, typename Allocator = GuardedAllocator> class Array { return m_data + m_size; } + IndexRange index_range() const + { + return IndexRange(m_size); + } + private: T *allocate(uint size) { |