Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-03-20 17:42:35 +0300
committerJacques Lucke <jacques@blender.org>2021-03-20 17:42:35 +0300
commit98721c85431d223c895a25d63dafb9e6637d34c4 (patch)
tree58a357fcef4d43f8d1e1e93835c9c2339eb66d18 /source/blender/blenlib/BLI_array.hh
parent59d3ec1eefd30a3f041a9b156b3e01607c2bcd71 (diff)
BLI: improve support for generic algorithms with c++ containers
Some generic algorithms from the standard library like `std::any_of` did not work with all container and iterator types. To improve the situation, this patch adds various type members to containers and iterators. Custom iterators for Set, Map and IndexRange now have an iterator category, which soe algorithms require. IndexRange could become a random access iterator, but adding all the missing methods can be done when it is necessary.
Diffstat (limited to 'source/blender/blenlib/BLI_array.hh')
-rw-r--r--source/blender/blenlib/BLI_array.hh10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_array.hh b/source/blender/blenlib/BLI_array.hh
index 284d62fb876..fc8fc615feb 100644
--- a/source/blender/blenlib/BLI_array.hh
+++ b/source/blender/blenlib/BLI_array.hh
@@ -60,6 +60,16 @@ template<
*/
typename Allocator = GuardedAllocator>
class Array {
+ public:
+ using value_type = T;
+ using pointer = T *;
+ using const_pointer = const T *;
+ using reference = T &;
+ using const_reference = const T &;
+ using iterator = T *;
+ using const_iterator = const T *;
+ using size_type = int64_t;
+
private:
/** The beginning of the array. It might point into the inline buffer. */
T *data_;