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 std::make_shared<Object> when creating shared_ptr #13

Closed
maximecaron opened this issue Oct 26, 2012 · 1 comment
Closed

use std::make_shared<Object> when creating shared_ptr #13

maximecaron opened this issue Oct 26, 2012 · 1 comment
Assignees

Comments

@maximecaron
Copy link
Collaborator

No description provided.

@ghost ghost assigned maximecaron Oct 26, 2012
@maximecaron
Copy link
Collaborator Author

Besides convenience and style, such a function is also exception safe and considerably faster because it can use a single allocation for both the object and its corresponding control block, eliminating a significant portion of shared_ptr's construction overhead. This eliminates one of the major efficiency complaints about shared_ptr.

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

No branches or pull requests

1 participant