-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
PoseGraphInterface can mostly be const #1021
Comments
Making the mutex |
That is a philosophical decision. We decided way back that in Cartographer, const should mean the same for the compiler and us, so we never used mutable ever. Further reading, though a bit outdated: |
I stumbled into this talk, which I found interesting. It argues that the meaning of |
@ojura - this is a nice talk, thanks for sharing. For those who can't spare the time to watch it, the summary is that in C+11 the meaning of That being said, I will move forward with changing |
Making getters and non-modifying methods in PoseGraph* const. Before most getters where marked non-const because of the need to acquire the mutex for thread safety. This forces all code using the PoseGraph to pass it around as a non-const object even if the consumer is not altering the object. By making the mutexes mutable we can make getters and methods that do not change the PoseGraph const and thus enable consumer APIs to express how they are going to use the PoseGraph as well. fixes #1021
Currently, all methods in
PoseGraphInterface
are not const, even though most of them can be.I think the reason was that they require a read mutex, but semantically, they are const.
The text was updated successfully, but these errors were encountered: