Skip to content

Instantly share code, notes, and snippets.

@saulozitos
Created April 27, 2021 18:37
Show Gist options
  • Save saulozitos/16b6b669cd6424fe11885450f3e44326 to your computer and use it in GitHub Desktop.
Save saulozitos/16b6b669cd6424fe11885450f3e44326 to your computer and use it in GitHub Desktop.
Template make_unique to C++11
#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