From 68a10dd1b0e683b571648c95b30c3941b1046252 Mon Sep 17 00:00:00 2001 From: aramis_acg Date: Tue, 31 May 2011 17:38:22 +0000 Subject: [PATCH] + add dummy implementation of make_shared to boost workaround (unlike the original, it does *not* offer any performance benefits). git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1023 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- code/BoostWorkaround/boost/make_shared.hpp | 57 ++++++++++++++++++++++ code/CMakeLists.txt | 1 + workspaces/vc9/assimp.vcproj | 4 ++ 3 files changed, 62 insertions(+) create mode 100644 code/BoostWorkaround/boost/make_shared.hpp diff --git a/code/BoostWorkaround/boost/make_shared.hpp b/code/BoostWorkaround/boost/make_shared.hpp new file mode 100644 index 000000000..b7b29caa5 --- /dev/null +++ b/code/BoostWorkaround/boost/make_shared.hpp @@ -0,0 +1,57 @@ + +// please note that this replacement implementation does not +// provide the performance benefit of the original, which +// makes only one allocation as opposed to two allocations +// (smart pointer counter and payload) which are usually +// required if object and smart pointer are constructed +// independently. + +#ifndef INCLUDED_AI_BOOST_MAKE_SHARED +#define INCLUDED_AI_BOOST_MAKE_SHARED + + +namespace boost { + + template + shared_ptr make_shared() { + return shared_ptr(new T()); + } + + template + shared_ptr make_shared(const T0& t0) { + return shared_ptr(new T(t0)); + } + + template + shared_ptr make_shared(const T0& t0, const T1& t1) { + return shared_ptr(new T(t0,t1)); + } + + template + shared_ptr make_shared(const T0& t0, const T1& t1, const T2& t2) { + return shared_ptr(new T(t0,t1,t2)); + } + + template + shared_ptr make_shared(const T0& t0, const T1& t1, const T2& t2, const T3& t3) { + return shared_ptr(new T(t0,t1,t2,t3)); + } + + template + shared_ptr make_shared(const T0& t0, const T1& t1, const T2& t2, const T3& t3, const T4& t4) { + return shared_ptr(new T(t0,t1,t2,t3,t4)); + } + + template + shared_ptr make_shared(const T0& t0, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5) { + return shared_ptr(new T(t0,t1,t2,t3,t4,t5)); + } + + template + shared_ptr make_shared(const T0& t0, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6) { + return shared_ptr(new T(t0,t1,t2,t3,t4,t5,t6)); + } +} + + +#endif diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 7bbf6e851..38a6f2331 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -70,6 +70,7 @@ SET( Boost_SRCS BoostWorkaround/boost/scoped_ptr.hpp BoostWorkaround/boost/shared_array.hpp BoostWorkaround/boost/shared_ptr.hpp + BoostWorkaround/boost/make_shared.hpp BoostWorkaround/boost/static_assert.hpp BoostWorkaround/boost/tuple/tuple.hpp ) diff --git a/workspaces/vc9/assimp.vcproj b/workspaces/vc9/assimp.vcproj index d490ba3d0..24f5ea033 100644 --- a/workspaces/vc9/assimp.vcproj +++ b/workspaces/vc9/assimp.vcproj @@ -4072,6 +4072,10 @@ RelativePath="..\..\code\BoostWorkaround\boost\lexical_cast.hpp" > + +