Handle return of std::unique_ptr objects

This commit is contained in:
Jason Turner 2017-02-03 19:34:12 -08:00
parent 2ce155237d
commit 1cb15d8b22

View File

@ -27,9 +27,7 @@ namespace chaiscript
namespace detail
{
/**
* Used internally for handling a return value from a Proxy_Function call
*/
/// Used internally for handling a return value from a Proxy_Function call
template<typename Ret>
struct Handle_Return
{
@ -155,6 +153,18 @@ namespace chaiscript
{
};
template<typename Ret>
struct Handle_Return<std::unique_ptr<Ret>> : Handle_Return<std::unique_ptr<Ret> &>
{
static Boxed_Value handle(std::unique_ptr<Ret> &&r)
{
return Boxed_Value(std::move(r), true);
}
};
template<typename Ret>
struct Handle_Return<const Ret &>
{