Created
April 27, 2021 18:37
-
-
Save saulozitos/16b6b669cd6424fe11885450f3e44326 to your computer and use it in GitHub Desktop.
Template make_unique to C++11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <memory> | |
| template<typename T, typename... Args> | |
| std::unique_ptr<T> make_unique(Args&&... args) | |
| { | |
| return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment