From 0a436398dd9612813f43824780d1e94f3c6c36c5 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Fri, 13 Jul 2012 12:25:50 -0600 Subject: [PATCH] Use make_shared #64 --- .../chaiscript/dispatchkit/boxed_value.hpp | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/include/chaiscript/dispatchkit/boxed_value.hpp b/include/chaiscript/dispatchkit/boxed_value.hpp index 59e7f90..59f777e 100644 --- a/include/chaiscript/dispatchkit/boxed_value.hpp +++ b/include/chaiscript/dispatchkit/boxed_value.hpp @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -77,12 +78,11 @@ namespace chaiscript { static boost::shared_ptr get(Boxed_Value::Void_Type) { - return boost::shared_ptr (new Data( + return boost::make_shared( detail::Get_Type_Info::get(), boost::any(), false, - 0) - ); + static_cast(0)); } template @@ -94,12 +94,11 @@ namespace chaiscript template static boost::shared_ptr get(const boost::shared_ptr &obj) { - return boost::shared_ptr(new Data( + return boost::make_shared( detail::Get_Type_Info::get(), boost::any(obj), false, - obj.get()) - ); + obj.get()); } template @@ -111,34 +110,31 @@ namespace chaiscript template static boost::shared_ptr get(boost::reference_wrapper obj) { - return boost::shared_ptr(new Data( + return boost::make_shared( detail::Get_Type_Info::get(), boost::any(obj), true, - obj.get_pointer()) - ); + obj.get_pointer()); } template static boost::shared_ptr get(const T& t) { boost::shared_ptr p(new T(t)); - return boost::shared_ptr(new Data( + return boost::make_shared( detail::Get_Type_Info::get(), boost::any(p), false, - p.get()) - ); + p.get()); } static boost::shared_ptr get() { - return boost::shared_ptr (new Data( + return boost::make_shared( Type_Info(), boost::any(), false, - 0) - ); + static_cast(0)); } };