[Insight-developers] Statistics class interface change

Bill Lorensen wlorens1 at nycap.rr.com
Sun Jul 16 12:16:24 EDT 2006


Brad,

Will this cause any exiting code to stop compiling? I think not, but I want 
to be sure.

Bill

At 02:29 PM 7/14/2006, Brad Davis wrote:
>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
>
>
>_______________________________________________
>Insight-developers mailing list
>Insight-developers at itk.org
>http://www.itk.org/mailman/listinfo/insight-developers



More information about the Insight-developers mailing list