Skip to content

TrkExInterfaces, etc: Adjust some Extrapolator methods.

IExtrapolator::extrapolateStepwise and extrapolateBlindly were returning

   const std::vector<const Trk::TrackParameters*>*

where the client is supposed to delete everything.

This is not really how we want to do things.

  • If we return ownership of objects, we should use unique_ptr.
  • We'd prefer to return the vector by value, rather than returning an object on the heap.
  • We're returning a new object, but it's declared const. This doesn't really gain anything, and some downstream code was ending up doing a const_cast.

This last point was really the motivation for the change, but as long as were changing that, also address the other two points.

Accordingly, these methods are changed to return

   std::vector<std::unique_ptr<const Trk::TrackParameters> >

Downstream clients are adjusted.

Other IExtrapolator methods are not changed at this point, but they should really also be changed to use unique_ptr at some point. (Using unique_ptr consistently would allow simplifying the implementation.)

Merge request reports

Loading