vrshoot

view 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 source
2 // please note that this replacement implementation does not
3 // provide the performance benefit of the original, which
4 // makes only one allocation as opposed to two allocations
5 // (smart pointer counter and payload) which are usually
6 // required if object and smart pointer are constructed
7 // independently.
9 #ifndef INCLUDED_AI_BOOST_MAKE_SHARED
10 #define INCLUDED_AI_BOOST_MAKE_SHARED
13 namespace boost {
15 template <typename T>
16 shared_ptr<T> make_shared() {
17 return shared_ptr<T>(new T());
18 }
20 template <typename T, typename T0>
21 shared_ptr<T> make_shared(const T0& t0) {
22 return shared_ptr<T>(new T(t0));
23 }
25 template <typename T, typename T0,typename T1>
26 shared_ptr<T> make_shared(const T0& t0, const T1& t1) {
27 return shared_ptr<T>(new T(t0,t1));
28 }
30 template <typename T, typename T0,typename T1,typename T2>
31 shared_ptr<T> make_shared(const T0& t0, const T1& t1, const T2& t2) {
32 return shared_ptr<T>(new T(t0,t1,t2));
33 }
35 template <typename T, typename T0,typename T1,typename T2,typename T3>
36 shared_ptr<T> make_shared(const T0& t0, const T1& t1, const T2& t2, const T3& t3) {
37 return shared_ptr<T>(new T(t0,t1,t2,t3));
38 }
40 template <typename T, typename T0,typename T1,typename T2,typename T3, typename T4>
41 shared_ptr<T> make_shared(const T0& t0, const T1& t1, const T2& t2, const T3& t3, const T4& t4) {
42 return shared_ptr<T>(new T(t0,t1,t2,t3,t4));
43 }
45 template <typename T, typename T0,typename T1,typename T2,typename T3, typename T4, typename T5>
46 shared_ptr<T> make_shared(const T0& t0, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5) {
47 return shared_ptr<T>(new T(t0,t1,t2,t3,t4,t5));
48 }
50 template <typename T, typename T0,typename T1,typename T2,typename T3, typename T4, typename T5, typename T6>
51 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) {
52 return shared_ptr<T>(new T(t0,t1,t2,t3,t4,t5,t6));
53 }
54 }
57 #endif