Page MenuHome

Blenlib: New ArrayRef data structure
ClosedPublic

Authored by Jacques Lucke (JacquesLucke) on Mon, Aug 26, 4:22 PM.

Details

Summary

This is the first of potentially many c++ extensions to blenlib.

This patch implements two new very similar data structures:
ArrayRef and MutableArrayRef. Both have a typed pointer
and a length of the referenced array.

This is inspired by the llvm code base. While working with it,
I noticed that these data structures make C++ development much
more comfortable in many circumstances.

They can make code faster by eliminating unnecessary copies and
conversions. They also make code simpler by avoiding unnecessary
templated parameters to support different containers as inputs.

Diff Detail

Repository
rB Blender
Branch
blenlib-array-ref (branched from master)
Build Status
Buildable 4617
Build 4617: arc lint + arc unit

Event Timeline

I'm fine with this direction, but this needs approval from @Sergey Sharybin (sergey) and @Campbell Barton (campbellbarton) as well, if it's ok to start adding c++ code in this module.

source/blender/blenlib/BLI_array_ref.hpp
33

save -> safe

This revision is now accepted and ready to land.Mon, Aug 26, 6:58 PM