From cc783cfc82ab99d90070193da71c4970bc08a96e Mon Sep 17 00:00:00 2001 From: scott-linder Date: Tue, 24 Dec 2013 22:42:03 -0500 Subject: Added entityx::make_ptr to mirror std::make_shared --- entityx/config.h.in | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/entityx/config.h.in b/entityx/config.h.in index 2e6f000..940d4d1 100644 --- a/entityx/config.h.in +++ b/entityx/config.h.in @@ -17,6 +17,8 @@ static const uint64_t MAX_COMPONENTS = ENTITYX_MAX_COMPONENTS; // Which shared_ptr implementation should we use? #include +// for std::forward() +#include namespace entityx { @@ -35,6 +37,11 @@ using enable_shared_from_this = std::enable_shared_from_this; namespace entityx { +template +ptr make_ptr(Args&&... args) { + return ptr(::new T(std::forward(args)...)); +} + template bool operator == (const weak_ptr &a, const weak_ptr &b) { return a.lock() == b.lock(); -- cgit v1.2.3