InsightSoftwareConsortium / ITK

Insight Toolkit (ITK) -- Official Repository. ITK builds on a proven, spatially-oriented architecture for processing, segmentation, and registration of scientific images in two, three, or more dimensions.
https://itk.org
Apache License 2.0
1.37k stars 660 forks source link

PERF: Add fast `noexcept` "move semantics" to `Array` #4730

Closed N-Dekker closed 1 week ago

N-Dekker commented 1 week ago
N-Dekker commented 1 week ago

It appears more complicated for Array than it was for Array2D, to implement a fast noexcept move-assignment operator. Because unlike Array2D, Array does have a m_LetArrayManageMemory flag. While its base class vnl_vector also has a m_LetArrayManageMemory flag. These two flags may have different (Boolean) values, for one and the same object. To be continued...!


Update, I find it too complicated to add move semantics on top of optional internal memory management, for an object that has two possibly contradicting (!) m_LetArrayManageMemory flags. (One of Array, and one of its base class vnl_vector.) So I give up for now 🤷