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

Add make_unique function omitted from C++11 #639

Merged
merged 3 commits into from
Mar 21, 2016
Merged

Add make_unique function omitted from C++11 #639

merged 3 commits into from
Mar 21, 2016

Conversation

jslee02
Copy link
Member

@jslee02 jslee02 commented Mar 20, 2016

This pull request adds make_unique function as suggested in #633 .

jslee02 added 2 commits March 20, 2016 12:20
This function can be replace by the standard std::make_unique<T>(...) when we migrate to using C++14.
@jslee02 jslee02 added this to the DART 6.0.0 milestone Mar 20, 2016
// an oversight". This can be replaced by std::make_unique<T> of the standard
// library when we migrate to using C++14.

} // namespace std
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is undefined to add declarations or definitions to the std namespace:

[C++11: 17.6.4.2.1/1]: The behavior of a C++ program is undefined if it adds declarations or definitions to namespace std or to a namespace within namespace std unless otherwise specified. A program may add a template specialization for any standard library template to namespace std only if the declaration depends on a user-defined type and the specialization meets the standard library requirements for the original template and is not explicitly prohibited.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense. Thanks!

> [C++11: 17.6.4.2.1/1]: The behavior of a C++ program is undefined if it adds declarations or definitions to namespace std or to a namespace within namespace std unless otherwise specified. A program may add a template specialization for any standard library template to namespace std only if the declaration depends on a user-defined type and the specialization meets the standard library requirements for the original template and is not explicitly prohibited.

Thanks to @mkoval for pointing this out
@mxgrey
Copy link
Member

mxgrey commented Mar 21, 2016

These changes look good to me 👍

jslee02 added a commit that referenced this pull request Mar 21, 2016
Add make_unique function omitted from C++11
@jslee02 jslee02 merged commit 7a2190b into master Mar 21, 2016
@jslee02 jslee02 deleted the make_unique branch March 23, 2016 22:18
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.

3 participants