diff --git a/src/Cppyy.h b/src/Cppyy.h index 2212ff3..6299815 100644 --- a/src/Cppyy.h +++ b/src/Cppyy.h @@ -335,6 +335,10 @@ namespace Cppyy { CPPYY_IMPORT std::string GetTypeAsString(TCppType_t type); CPPYY_IMPORT + bool IsRValueReferenceType(TCppType_t type); + CPPYY_IMPORT + bool IsLValueReferenceType(TCppType_t type); + CPPYY_IMPORT bool IsClassType(TCppType_t type); CPPYY_IMPORT bool IsFunctionPointerType(TCppType_t type); diff --git a/src/Dispatcher.cxx b/src/Dispatcher.cxx index 228dc03..2d2e571 100644 --- a/src/Dispatcher.cxx +++ b/src/Dispatcher.cxx @@ -320,7 +320,10 @@ bool CPyCppyy::InsertDispatcher(CPPScope* klass, PyObject* bases, PyObject* dct, code << "{\n return " << binfo.bname << "::" << mtCppName << "("; for (Cppyy::TCppIndex_t i = 0; i < nArgs; ++i) { if (i != 0) code << ", "; - code << "arg" << i; + if (Cppyy::IsRValueReferenceType(Cppyy::GetMethodArgType(method, i))) + code << "std::move(arg" << i << ")"; + else + code << "arg" << i; } code << ");\n }\n"; }