From: scott-linder Date: Wed, 25 Dec 2013 03:42:03 +0000 (-0500) Subject: Added entityx::make_ptr to mirror std::make_shared X-Git-Url: https://code.bitgloo.com/?a=commitdiff_plain;h=cc783cfc82ab99d90070193da71c4970bc08a96e;p=clyne%2Fentityx.git Added entityx::make_ptr to mirror std::make_shared --- 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();