From c2e80cfaa302e666421a8adee8d2b25a69d0700e Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Fri, 7 Feb 2020 17:23:25 +0100 Subject: BLI: add index_range method to some data structures This can be used to iterate over all indices with less code. --- source/blender/blenlib/BLI_vector.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/blender/blenlib/BLI_vector.h') diff --git a/source/blender/blenlib/BLI_vector.h b/source/blender/blenlib/BLI_vector.h index 46c46a1440f..5c03a896692 100644 --- a/source/blender/blenlib/BLI_vector.h +++ b/source/blender/blenlib/BLI_vector.h @@ -37,6 +37,7 @@ #include "BLI_listbase_wrapper.h" #include "BLI_math_base.h" #include "BLI_allocator.h" +#include "BLI_index_range.h" #include "MEM_guardedalloc.h" @@ -520,6 +521,11 @@ template class Ve return (uint)(m_capacity_end - m_begin); } + IndexRange index_range() const + { + return IndexRange(this->size()); + } + void print_stats() const { std::cout << "Small Vector at " << (void *)this << ":" << std::endl; -- cgit v1.2.3