您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

58 行
1.9 KiB

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