mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 01:53:45 +01:00
Add make_irr
This commit is contained in:
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
|
||||
|
Loading…
Reference in New Issue
Block a user