-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A mechanism for prepending a Forkable to another Forkable #3122
Conversation
physics/forkable.hpp
Outdated
// the structure of the various trajectories (that's the case in tests). | ||
// This trajectory is still a valid pointer, but it may now be owned by the | ||
// parent of T. The only pointer that the client might assume to own is | ||
// this->root(). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let’s make this a static method that takes both roots by unique_ptr
as well as a pointer to trajectory
(whose root must be the prepended one), and returns whichever unique_ptr
remains; taking ownership of this
is a bad idea (and likewise for trajectory->root()
), and having a unique_ptr
to the non-const root of trajectory
will ensure that the const_cast
in the implementation does not introduce UB.
A very boring part of #2400.