[Insight-developers] Statistics class interface change

Brad Davis brad.davis at kitware.com
Fri Jul 14 14:29:54 EDT 2006


All,

In the class itk::Statistics::itkListSample I want to change the argument to
the PushBack method from pass-by-value to pass-by-reference.  That is,
change

void PushBack( MeasurementVectorType mv );

to

void PushBack( const MeasurementVectorType& mv );

The reasons are:

1)
When calling PushBack(MeasurementVectorType mv), two copies of mv are
made---one of them is unnecessary.  Because of call by value, a copy of the
measurement vector is placed on the stack.  A copy of this copy is then made
by the std::vector<MeasurementVectorType>::push_back() call.

2)
The other methods for setting measurement vectors in this class, e.g.
,SetMeasurementVector(const InstanceIdentifier &id, const
MeasurementVectorType &mv) use call by reference, so the interface is
inconsistent.

Any comments welcome.  As expected, all the tests under 'ctest -D
ExperimentalTest' passed after the change.

Brad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.itk.org/mailman/private/insight-developers/attachments/20060714/be308bb3/attachment.htm


More information about the Insight-developers mailing list