From 1cb15d8b226818464495399d57ac95edc8bb3012 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Fri, 3 Feb 2017 19:34:12 -0800 Subject: [PATCH] Handle return of std::unique_ptr objects --- include/chaiscript/dispatchkit/handle_return.hpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/include/chaiscript/dispatchkit/handle_return.hpp b/include/chaiscript/dispatchkit/handle_return.hpp index 2b770ac..4d0930e 100644 --- a/include/chaiscript/dispatchkit/handle_return.hpp +++ b/include/chaiscript/dispatchkit/handle_return.hpp @@ -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 struct Handle_Return { @@ -155,6 +153,18 @@ namespace chaiscript { }; + + template + struct Handle_Return> : Handle_Return &> + { + static Boxed_Value handle(std::unique_ptr &&r) + { + return Boxed_Value(std::move(r), true); + } + }; + + + template struct Handle_Return {