diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/irr_ptr.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/irr_ptr.h b/src/irr_ptr.h index 43add00da..f1caf9c7d 100644 --- a/src/irr_ptr.h +++ b/src/irr_ptr.h @@ -19,6 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #pragma once #include <type_traits> +#include <utility> #include "irrlichttypes.h" #include "IReferenceCounted.h" @@ -197,4 +198,12 @@ bool operator!=(const ReferenceCounted *a, const irr_ptr<ReferenceCounted> &b) n return a != b.get(); } +/** Same as std::make_unique<T>, but for irr_ptr. + */ +template <class T, class... Args> +irr_ptr<T> make_irr(Args&&... args) +{ + return irr_ptr<T>(new T(std::forward<Args>(args)...)); +} + // clang-format on |