Trk::Track : Hold the TrackStates as ptr rather than value. Otherwise we lose the DV polymorphic behaviour
Trk::Track :
Hold the TrackStates as ptr rather than value. Otherwise we lose (splice) the polymorphic behaviour of the DataVector.
e.g we "effectively" we want
struct foo {
std::unique_ptr<Base> m_bar;
};
rather than
struct foo {
Base m_bar;
};
So at to able to recover Derived
.
The DataVector
although is a kind of a vector also has this polymorphic behaviour.
Actually this was tried in smaller scale (when we wanted to have custom allocators here) !46853 (diffs) (let me ping @ssnyder but in principle I think we should have kept that and double down as breaking the polymorphic behaviour of the DV creates some other issues also)
The main changes
- We hold a unique_ptr in the Track.h
- We expand the relevant test to cover things that this now allows us to do.
- We change the clients to pass
unique_ptr
. With respect to the 1st older try theunique_ptr
is more visible i.e in the one in the past there was one unique_ptr created ,anyhow, via a copy of the value.
Edited by Christos Anastopoulos