-
Notifications
You must be signed in to change notification settings - Fork 61
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
Take args by const reference where useful. #58
Take args by const reference where useful. #58
Conversation
Just noticed: this would fix #13. |
Thanks for the PR 👍 . Unfortunately reviewing and merging it is going to take some time, as both me and @jontje have a very busy few weeks ahead of us. |
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.
Very nice job! Greatly appreciated, this has been pending for quite some time.
All my tests pass, and I have added a few minor code changes concerning line lengths. And if you resolve the branch conflicts, then I will approve the PR.
FYI, the code style of this library has primarily been based on the ROS C++ Style Guide, which specify a maximum line length of 120 characters. I don’t think this is mentioned anywhere, so it’s impossible for you to know.
A class should either define both a manual copy constructor and copy assignment operator, or neither. In this case, the implementation was equivalent to the implicit version already created by the compiler, so the operator could be removed without problem.
Co-Authored-By: jontje <jontje@users.noreply.github.com>
Thanks for the review. I applied your suggestions and rebased on current master.
I generally try to guess style rules from the surrounding code, but I may accidentally revert to my own preferences now and then. Good thing the review caught it :) |
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.
Approving according to my previous comment at #58 (review).
Thanks! 👍
No worries, and I try to at least be semi-pedantic when reviewing;) |
This PR does a couple of things:
const &
where useful (likestd::string
or objects containing strings).-Wall -Wextra -Wpedantic
without warnings:TriBool
had a manual copy assignment operator, but not a manual copy constructor.The arguments by const & is the most important part of the PR, as it can lead to actual performance improvement.
Note that in some cases, for constructors, taking objects by value and moving them into members would be even more efficient, but that would mean requiring C++11. It looked like the project doesn't require that yet, so I decided not to go for that.