From 72aedca39ce00e8da8693a3ec0c019d1c9a8ac45 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Mon, 29 Jun 2015 20:43:12 -0600 Subject: [PATCH] Fix wrapping of functions with move only params --- .../dispatchkit/function_call_detail.hpp | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/include/chaiscript/dispatchkit/function_call_detail.hpp b/include/chaiscript/dispatchkit/function_call_detail.hpp index fb6b5fc..b558138 100644 --- a/include/chaiscript/dispatchkit/function_call_detail.hpp +++ b/include/chaiscript/dispatchkit/function_call_detail.hpp @@ -76,16 +76,36 @@ namespace chaiscript { } - Ret operator()(Param...param) + template + Ret operator()(P&& ... param) { return Function_Caller_Ret::value && !std::is_same::value>::call(m_funcs, { - (std::is_reference::value&&!(std::is_same::type>::type>::value))?Boxed_Value(std::ref(param)):Boxed_Value(param)... + box

(std::forward

(param))... }, m_conversions ); } + template + static auto box(Q&& q) -> typename std::enable_if::value&&!std::is_same::type>::type>::value, Boxed_Value>::type + { + return Boxed_Value(std::ref(std::forward(q))); + } + + template + static auto box(Q&& q) -> typename std::enable_if::value&&!std::is_same::type>::type>::value, Boxed_Value>::type + { + return Boxed_Value(std::forward(q)); + } + + template + static Boxed_Value box(Boxed_Value bv) + { + return bv; + } + + std::vector m_funcs; Type_Conversions m_conversions; };