Skip to content
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

Merged
merged 12 commits into from
Sep 5, 2021

Conversation

pleroy
Copy link
Member

@pleroy pleroy commented Sep 5, 2021

A very boring part of #2400.

// 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().
Copy link
Member

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.

@eggrobin eggrobin added the LGTM label Sep 5, 2021
@pleroy pleroy merged commit 4fb24d4 into mockingbirdnest:Entwurf Sep 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants