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

Ownership semantics for the marginal trees. #292

Open
molpopgen opened this issue Sep 16, 2020 · 4 comments
Open

Ownership semantics for the marginal trees. #292

molpopgen opened this issue Sep 16, 2020 · 4 comments

Comments

@molpopgen
Copy link
Owner

We currently store an object and return a const reference via a getter. This design is rather inelegant. We should refactor to use shared pointers. The getter returns a pointer to const object to prevent modification by the caller.

@molpopgen molpopgen added this to the 0.9.0 milestone Sep 16, 2020
@molpopgen
Copy link
Owner Author

Getting this right is a bit annoying. On the caller's side, one must use auto && to properly receive the shared_ptr as const.

@molpopgen
Copy link
Owner Author

This should be handled along with #294, at which point we should deprecate the existing types that do the const & method.

@molpopgen molpopgen removed this from the 0.9.0 milestone Nov 5, 2020
@molpopgen
Copy link
Owner Author

Random thought: this may all be best handled by a get method returning const *?

@molpopgen
Copy link
Owner Author

Random thought: this may all be best handled by a get method returning const *?

No -- you can always delete a pointer. Seems like the smartest thing here is the shared/weak pointer duo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant