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

const correctness flawed due to shared_ptr/unique_ptr usage #18

Closed
neiser opened this issue Feb 21, 2016 · 0 comments
Closed

const correctness flawed due to shared_ptr/unique_ptr usage #18

neiser opened this issue Feb 21, 2016 · 0 comments
Labels

Comments

@neiser
Copy link
Contributor

neiser commented Feb 21, 2016

The main data structure ant::TEvent and ant::TEventData use std::unique_ptr and std::shared_ptr for the rather complex inter-event data dependencies (for example, particles point to their candidate they were made of, etc.). However, the const-ness of the TEvent given to physics classes does not apply to the objects managed as shared_ptr. So users can change events in physics classes, and influencing other physics classes unknowingly. That's a huge design flaw...

Likewise, the ant::Tree structure is also not const correctly implemented.

Creating some cc_shared_ptr which transfers its own constness to the managed object could be a nice solution. But implementation is far from being trivial (see branch cc_shared).

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

No branches or pull requests

1 participant