Blender Git Loki
Git Commits -> Revision 369d5e8
Revision 369d5e8 by Jacques Lucke (master) September 12, 2019, 12:23 (GMT) |
BLI: new C++ ArrayRef, Vector, Stack, ... data structures Many generic C++ data structures have been developed in the functions branch. This commit merges a first chunk of them into master. The following new data structures are included: Array: Owns a memory buffer with a fixed size. It is different from std::array in that the size is not part of the type. ArrayRef: References an array owned by someone else. All elements in the referenced array are considered to be const. This should be the preferred parameter type for functions that take arrays as input. MutableArrayRef: References an array owned by someone else. The elements in the referenced array can be changed. IndexRange: Specifies a continuous range of integers with a start and end index. IntrusiveListBaseWrapper: A utility class that allows iterating over ListBase instances where the prev and next pointer are stored in the objects directly. Stack: A stack implemented on top of a vector. Vector: An array that can grow dynamically. Allocators: Three allocator types are included that can be used by the container types to support different use cases. The Stack and Vector support small object optimization. So when the amount of elements in them is below a certain threshold, no memory allocation is performed. Additionally, most methods have unit tests. I'm merging this without normal code review, after I checked the code roughly with Sergey, and after we talked about it with Brecht. |
Commit Details:
Full Hash: 369d5e8ad2bb7c249c6b941779066b6aa99f9ea0
Parent Commit: 1954723
Lines Changed: +3104, -1
17 Added Paths:
/source/blender/blenlib/BLI_allocator.h (+127, -0) (View)
/source/blender/blenlib/BLI_array_cxx.h (+195, -0) (View)
/source/blender/blenlib/BLI_array_ref.h (+423, -0) (View)
/source/blender/blenlib/BLI_index_range.h (+193, -0) (View)
/source/blender/blenlib/BLI_listbase_wrapper.h (+97, -0) (View)
/source/blender/blenlib/BLI_memory_utils_cxx.h (+81, -0) (View)
/source/blender/blenlib/BLI_stack_cxx.h (+142, -0) (View)
/source/blender/blenlib/BLI_temporary_allocator.h (+64, -0) (View)
/source/blender/blenlib/BLI_temporary_allocator_cxx.h (+35, -0) (View)
/source/blender/blenlib/BLI_vector.h (+601, -0) (View)
/source/blender/blenlib/intern/BLI_index_range.cc (+59, -0) (View)
/source/blender/blenlib/intern/BLI_temporary_allocator.cc (+115, -0) (View)
/tests/gtests/blenlib/BLI_array_ref_test.cc (+266, -0) (View)
/tests/gtests/blenlib/BLI_array_test.cc (+103, -0) (View)
/tests/gtests/blenlib/BLI_index_range_test.cc (+131, -0) (View)
/tests/gtests/blenlib/BLI_stack_cxx_test.cc (+52, -0) (View)
/tests/gtests/blenlib/BLI_vector_test.cc (+400, -0) (View)
/source/blender/blenlib/BLI_array_cxx.h (+195, -0) (View)
/source/blender/blenlib/BLI_array_ref.h (+423, -0) (View)
/source/blender/blenlib/BLI_index_range.h (+193, -0) (View)
/source/blender/blenlib/BLI_listbase_wrapper.h (+97, -0) (View)
/source/blender/blenlib/BLI_memory_utils_cxx.h (+81, -0) (View)
/source/blender/blenlib/BLI_stack_cxx.h (+142, -0) (View)
/source/blender/blenlib/BLI_temporary_allocator.h (+64, -0) (View)
/source/blender/blenlib/BLI_temporary_allocator_cxx.h (+35, -0) (View)
/source/blender/blenlib/BLI_vector.h (+601, -0) (View)
/source/blender/blenlib/intern/BLI_index_range.cc (+59, -0) (View)
/source/blender/blenlib/intern/BLI_temporary_allocator.cc (+115, -0) (View)
/tests/gtests/blenlib/BLI_array_ref_test.cc (+266, -0) (View)
/tests/gtests/blenlib/BLI_array_test.cc (+103, -0) (View)
/tests/gtests/blenlib/BLI_index_range_test.cc (+131, -0) (View)
/tests/gtests/blenlib/BLI_stack_cxx_test.cc (+52, -0) (View)
/tests/gtests/blenlib/BLI_vector_test.cc (+400, -0) (View)