-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Update std::shared_ptr argument passing to be closer to idiomatic C++. #1818
Update std::shared_ptr argument passing to be closer to idiomatic C++. #1818
Conversation
Some build failures, e.g.:
|
a2fe71a
to
bdb4a36
Compare
sherm1: Thanks, hopefully fixed, although I'll have to rely on CI as I don't have matlab locally to test. |
(other->parent.get() == this && | ||
!(other->joint && other->joint->isFloating()))); | ||
bool adjacentTo(const RigidBody& other) const { | ||
return ((parent.get() == &other && !(joint && joint->isFloating())) || |
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.
This and some of the nearby methods would be clearer with a utility method something like
return (parent->isSameRigidBody(other) && ...);
Looks good to me, pending builds. |
Well, the windows jenkins build failed, and while the build output is full of warnings, I think the actual failure was just #1787 ? |
Yeah, the |
bdb4a36
to
6130b05
Compare
Updated to fix merge conflicts. |
Does anyone know why jenkins failed here? It looks like it was trying to pull the incorrect git hash? |
retest this please |
6130b05
to
9f569bd
Compare
9f569bd
to
16d0c77
Compare
Great, I believe the spurious Windows jenkins failures are now resolved. |
@jamiesnape -- why did this pass on jenkins (but not appveyor)? it should not have passed without #1843 being merged. |
@billhoffman added an environment variable specifying the generator for now. |
(in the Jenkins build script, that is) |
that doesn't explain why the pendulum urdf test passed. |
The CppCoreGuidelines recommend that std::shared_ptr only be passed as an argument when the callee explicitly needs to manage the lifetime of the argument, and that 'const std::shared_ptr<T>&' should only be used if there is a chance that lifetime will not be shared. https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rr-smartptrparam Many instances in drake were passing 'const std::shared_ptr<T>&' around, often when no lifetime management was necessary, and otherwise when lifetime sharing was unconditional. This can be less efficient, unnecessarily restrictive, and hides the intent of the API. This patch converts those instances either to: * [const] T& if no lifetime sharing is required * std::shared_ptr<T> if lifetime sharing is always required
16d0c77
to
82ecb83
Compare
Update std::shared_ptr argument passing to be closer to idiomatic C++.
The CppCoreGuidelines recommend that std::shared_ptr only be passed as
an argument when the callee explicitly needs to manage the lifetime of
the argument, and that 'const std::shared_ptr&' should only be used
if there is a chance that lifetime will not be shared.
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rr-smartptrparam
Many instances in drake were passing 'const std::shared_ptr&'
around, often when no lifetime management was necessary, and otherwise
when lifetime sharing was unconditional. This can be less efficient,
unnecessarily restrictive, and hides the intent of the API.
This patch converts those instances either to: