Add make_irr

This commit is contained in:
Desour 2023-04-10 18:42:59 +02:00 committed by DS
parent d39a07efea
commit ceec560779

@ -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