Make constructors return values, not shared_ptr

This commit is contained in:
Jason Turner 2017-08-22 15:54:42 -06:00
parent b810e4f7d9
commit ac7af60d76
3 changed files with 5 additions and 5 deletions

View File

@ -17,8 +17,8 @@ namespace chaiscript {
struct Constructor struct Constructor
{ {
template<typename ... Inner> template<typename ... Inner>
std::shared_ptr<Class> operator()(Inner&& ... inner) const { constexpr Class operator()(Inner&& ... inner) const {
return std::make_shared<Class>(std::forward<Inner>(inner)...); return Class(std::forward<Inner>(inner)...);
} }
}; };

View File

@ -1363,8 +1363,8 @@ namespace chaiscript
const auto lhssize = lhsparamtypes.size(); const auto lhssize = lhsparamtypes.size();
const auto rhssize = rhsparamtypes.size(); const auto rhssize = rhsparamtypes.size();
static const auto boxed_type = user_type<Boxed_Value>(); constexpr const auto boxed_type = user_type<Boxed_Value>();
static const auto boxed_pod_type = user_type<Boxed_Number>(); constexpr const auto boxed_pod_type = user_type<Boxed_Number>();
for (size_t i = 1; i < lhssize && i < rhssize; ++i) for (size_t i = 1; i < lhssize && i < rhssize; ++i)
{ {

View File

@ -26,7 +26,7 @@ namespace chaiscript
auto call = dispatch::detail::Constructor<Class, Params...>(); auto call = dispatch::detail::Constructor<Class, Params...>();
return Proxy_Function( return Proxy_Function(
chaiscript::make_shared<dispatch::Proxy_Function_Base, dispatch::Proxy_Function_Callable_Impl<std::shared_ptr<Class> (Params...), decltype(call)>>(call)); chaiscript::make_shared<dispatch::Proxy_Function_Base, dispatch::Proxy_Function_Callable_Impl<Class (Params...), decltype(call)>>(call));
} }
} }
} }