Reduce versions of shared_ptr created
This commit is contained in:
parent
9326539f3b
commit
04bceedf64
@ -158,7 +158,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
if (itr != m_instances.end()) { return itr->second; }
|
if (itr != m_instances.end()) { return itr->second; }
|
||||||
|
|
||||||
std::shared_ptr<T> new_instance(new T());
|
std::shared_ptr<T> new_instance(std::make_shared<T>());
|
||||||
|
|
||||||
m_instances.insert(std::make_pair(std::this_thread::get_id(), new_instance));
|
m_instances.insert(std::make_pair(std::this_thread::get_id(), new_instance));
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ namespace chaiscript
|
|||||||
Proxy_Function build_constructor_(Class (*)(Params...))
|
Proxy_Function build_constructor_(Class (*)(Params...))
|
||||||
{
|
{
|
||||||
typedef std::shared_ptr<Class> (sig)(Params...);
|
typedef std::shared_ptr<Class> (sig)(Params...);
|
||||||
return Proxy_Function(new Proxy_Function_Impl<sig>(std::function<sig>(&(constructor_<Class, Params...>))));
|
return Proxy_Function(static_cast<Proxy_Function_Impl_Base *>(new Proxy_Function_Impl<sig>(std::function<sig>(&(constructor_<Class, Params...>)))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ namespace chaiscript
|
|||||||
{
|
{
|
||||||
/// \todo is it possible to reduce the number of templates generated here?
|
/// \todo is it possible to reduce the number of templates generated here?
|
||||||
return Proxy_Function(
|
return Proxy_Function(
|
||||||
new Proxy_Function_Impl<typename FunctionSignature<decltype(to_function(t)) >::Signature>(to_function(t)));
|
static_cast<dispatch::Proxy_Function_Impl_Base *>(new Proxy_Function_Impl<typename FunctionSignature<decltype(to_function(t)) >::Signature>(to_function(t))));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ namespace chaiscript
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
Proxy_Function fun(const std::function<T> &f)
|
Proxy_Function fun(const std::function<T> &f)
|
||||||
{
|
{
|
||||||
return Proxy_Function(new dispatch::Proxy_Function_Impl<T>(f));
|
return Proxy_Function(static_cast<dispatch::Proxy_Function_Impl_Base *>(new dispatch::Proxy_Function_Impl<T>(f)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user