vrshoot
diff libs/assimp/boost/make_shared.hpp @ 0:b2f14e535253
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 01 Feb 2014 19:58:19 +0200 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/libs/assimp/boost/make_shared.hpp Sat Feb 01 19:58:19 2014 +0200 1.3 @@ -0,0 +1,57 @@ 1.4 + 1.5 +// please note that this replacement implementation does not 1.6 +// provide the performance benefit of the original, which 1.7 +// makes only one allocation as opposed to two allocations 1.8 +// (smart pointer counter and payload) which are usually 1.9 +// required if object and smart pointer are constructed 1.10 +// independently. 1.11 + 1.12 +#ifndef INCLUDED_AI_BOOST_MAKE_SHARED 1.13 +#define INCLUDED_AI_BOOST_MAKE_SHARED 1.14 + 1.15 + 1.16 +namespace boost { 1.17 + 1.18 + template <typename T> 1.19 + shared_ptr<T> make_shared() { 1.20 + return shared_ptr<T>(new T()); 1.21 + } 1.22 + 1.23 + template <typename T, typename T0> 1.24 + shared_ptr<T> make_shared(const T0& t0) { 1.25 + return shared_ptr<T>(new T(t0)); 1.26 + } 1.27 + 1.28 + template <typename T, typename T0,typename T1> 1.29 + shared_ptr<T> make_shared(const T0& t0, const T1& t1) { 1.30 + return shared_ptr<T>(new T(t0,t1)); 1.31 + } 1.32 + 1.33 + template <typename T, typename T0,typename T1,typename T2> 1.34 + shared_ptr<T> make_shared(const T0& t0, const T1& t1, const T2& t2) { 1.35 + return shared_ptr<T>(new T(t0,t1,t2)); 1.36 + } 1.37 + 1.38 + template <typename T, typename T0,typename T1,typename T2,typename T3> 1.39 + shared_ptr<T> make_shared(const T0& t0, const T1& t1, const T2& t2, const T3& t3) { 1.40 + return shared_ptr<T>(new T(t0,t1,t2,t3)); 1.41 + } 1.42 + 1.43 + template <typename T, typename T0,typename T1,typename T2,typename T3, typename T4> 1.44 + shared_ptr<T> make_shared(const T0& t0, const T1& t1, const T2& t2, const T3& t3, const T4& t4) { 1.45 + return shared_ptr<T>(new T(t0,t1,t2,t3,t4)); 1.46 + } 1.47 + 1.48 + template <typename T, typename T0,typename T1,typename T2,typename T3, typename T4, typename T5> 1.49 + shared_ptr<T> make_shared(const T0& t0, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5) { 1.50 + return shared_ptr<T>(new T(t0,t1,t2,t3,t4,t5)); 1.51 + } 1.52 + 1.53 + template <typename T, typename T0,typename T1,typename T2,typename T3, typename T4, typename T5, typename T6> 1.54 + shared_ptr<T> make_shared(const T0& t0, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6) { 1.55 + return shared_ptr<T>(new T(t0,t1,t2,t3,t4,t5,t6)); 1.56 + } 1.57 +} 1.58 + 1.59 + 1.60 +#endif