|
[Rivet] Dangerous casting to FinalStateDavid Grellscheid david.grellscheid at durham.ac.ukThu Jul 9 21:08:09 BST 2015
Hi all, first of all, please do not hide copy constructors or assignment constructors just because of this issue. If you really want to prevent slicing construction, Frank's diff will work, but needs to be added to every projection class: private: template <typename AVOID_SLICING__USE_REFERENCES_INSTEAD> FinalState(AVOID_SLICING__USE_REFERENCES_INSTEAD); where 'FinalState' needs to be the actual class name. >> In that case we would need to understand why >> VetoedFinalState remainder = zfinder.remainingFinalState(); >> addProjection(remainder, "RFS"); >> (i.e. making a full copy, not just by reference) >> makes Rivet's projection book-keeping fall over: >> >> Error in MY_RFSTEST2c::init method: No projections registered >> for >> parent 0x7ffe07be8840 I guess that's because we don't have a dedicated copy constructor that re-registers the copy with the handler. This now would be a valid reason to ban copies completely, but needs to be done consistently throughout the projection machinery. David
More information about the Rivet mailing list |