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

use make_shared wherever possible #116

Merged
merged 2 commits into from
Oct 25, 2019

Conversation

mlautman
Copy link
Contributor

Quoting @tylerjw

For exception safety, memory leak avoidance, and performance reasons (one call to malloc instead of two) always use make_shared instead of new.

Also, when using make shared to create a new local variable use auto because the type is already represented in the template for make_shared and putting it at the start of the line does not add any more useful information or make the code more readable.

Reference: https://stackoverflow.com/questions/14836691/is-it-better-to-use-shared-ptr-reset-or-operator

@mlautman mlautman requested a review from rhaschke October 24, 2019 20:24
@rhaschke rhaschke merged commit 5af80ad into moveit:melodic-devel Oct 25, 2019
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

Successfully merging this pull request may close these issues.

2 participants