Closed N-Dekker closed 1 week ago
Example in the current code, from https://github.com/InsightSoftwareConsortium/ITK/blob/abb592882a3f4665bdfd7ff4ce835bd3862b835d/Modules/Registration/Common/include/itkMultiResolutionPyramidImageFilter.hxx#L62
m_Schedule = ScheduleType(m_NumberOfLevels, ImageDimension, 0);
ScheduleType
is defined as itk::Array2D<unsigned int>
, so ScheduleType(m_NumberOfLevels, ImageDimension, 0)
yields a temporary Array2D
object (an r-value). With this pull request, the statement above here will do a fast noexcept
move-assignment. (Until now, it would do a rather expensive copy.)
Probably not the best example, because such a schedule object is usually quite small anyway. But you get the picture 😸
Added a
noexcept
move-constructor and move-assignment operator toArray2D
, which both move the data of theArray2D
.Previously, an attempt to "move" an
Array2D
would have done an expensive copy.