Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use make_shared #64

  • Loading branch information...
commit 0a436398dd9612813f43824780d1e94f3c6c36c5 1 parent bf4f90a
@lefticus lefticus authored
Showing with 11 additions and 15 deletions.
  1. +11 −15 include/chaiscript/dispatchkit/boxed_value.hpp
View
26 include/chaiscript/dispatchkit/boxed_value.hpp
@@ -13,6 +13,7 @@
#include <map>
#include <boost/shared_ptr.hpp>
+#include <boost/make_shared.hpp>
#include <boost/any.hpp>
#include <boost/function.hpp>
#include <boost/ref.hpp>
@@ -77,12 +78,11 @@ namespace chaiscript
{
static boost::shared_ptr<Data> get(Boxed_Value::Void_Type)
{
- return boost::shared_ptr<Data> (new Data(
+ return boost::make_shared<Data>(
detail::Get_Type_Info<void>::get(),
boost::any(),
false,
- 0)
- );
+ static_cast<void *>(0));
}
template<typename T>
@@ -94,12 +94,11 @@ namespace chaiscript
template<typename T>
static boost::shared_ptr<Data> get(const boost::shared_ptr<T> &obj)
{
- return boost::shared_ptr<Data>(new Data(
+ return boost::make_shared<Data>(
detail::Get_Type_Info<T>::get(),
boost::any(obj),
false,
- obj.get())
- );
+ obj.get());
}
template<typename T>
@@ -111,34 +110,31 @@ namespace chaiscript
template<typename T>
static boost::shared_ptr<Data> get(boost::reference_wrapper<T> obj)
{
- return boost::shared_ptr<Data>(new Data(
+ return boost::make_shared<Data>(
detail::Get_Type_Info<T>::get(),
boost::any(obj),
true,
- obj.get_pointer())
- );
+ obj.get_pointer());
}
template<typename T>
static boost::shared_ptr<Data> get(const T& t)
{
boost::shared_ptr<T> p(new T(t));
- return boost::shared_ptr<Data>(new Data(
+ return boost::make_shared<Data>(
detail::Get_Type_Info<T>::get(),
boost::any(p),
false,
- p.get())
- );
+ p.get());
}
static boost::shared_ptr<Data> get()
{
- return boost::shared_ptr<Data> (new Data(
+ return boost::make_shared<Data>(
Type_Info(),
boost::any(),
false,
- 0)
- );
+ static_cast<void *>(0));
}
};
Please sign in to comment.
Something went wrong with that request. Please try again.