Add move operations to simb::MCParticle
simb::MCParticle is written in a way that explicitly prevents move operations.
In fact, move operations are implemented with copy, that does not free the memory in excess.
For example, if my particle has 5 trajectory points and I move into it another particle with 3 trajectory points, my particle will still have memory allocated for 5 points.
The solution is simply to explicitly add default move constructors in
MCParticle(MCParticle&&) = default; MCParticle& operator= (MCParticle&&) = default;
I am elevating the priority of this because it's a straightforward change that may have immediate, transparent gain.
Added move constructor and assignment to simb::MCParticle
This solves issue #12067.
Removed virtual destructor from simb::MCParticle
This implements the additional suggestion from issue #12067.
#6 Updated by Gianluca Petrillo over 2 years ago
- Status changed from Assigned to Work in progress
- % Done changed from 0 to 90
The two suggested changes are implemented in branch feature/gp_Issue12067 of nusimdata.
The other stakeholders of nutools should confirm that the removal of the virtual table from
simb::MCParticle has no consequence on their code.
The only issues I can think of are when using
As a reminder, art discourages data product classes from being polymorphic.
#11 Updated by Lynn Garren about 2 years ago
- Status changed from Work in progress to Resolved
- % Done changed from 90 to 100
Applied in changeset nusimdata:997565914af233bec48acc832fada59bc4f21ecd.