diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2022-07-03 13:58:26 +0100 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2022-07-04 11:19:29 +0100 |
commit | 71cd6a38fe539a89dc2ee159c6d54017fd4e90a0 (patch) | |
tree | 4f7ab68006694285eafcfd5775d940310093f007 /Lib/csharp | |
parent | e75095e6c56ac45aba7aaafb4c732e1f1c675591 (diff) | |
download | swig-71cd6a38fe539a89dc2ee159c6d54017fd4e90a0.tar.gz |
Performance optimisation for directors for classes passed by value
The directorin typemaps in the director methods now use std::move on the
input parameter when copying the object from the stack to the heap prior
to the callback into the target language, thereby taking advantage of
move semantics if available.
Diffstat (limited to 'Lib/csharp')
-rw-r--r-- | Lib/csharp/boost_shared_ptr.i | 2 | ||||
-rw-r--r-- | Lib/csharp/csharp.swg | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/Lib/csharp/boost_shared_ptr.i b/Lib/csharp/boost_shared_ptr.i index 508c0ec14..2bbb6e277 100644 --- a/Lib/csharp/boost_shared_ptr.i +++ b/Lib/csharp/boost_shared_ptr.i @@ -32,7 +32,7 @@ %{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %} %typemap(directorin) CONST TYPE -%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype((const $1_ltype &)$1)); %} +%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype(SWIG_STD_MOVE($1))); %} %typemap(directorout) CONST TYPE %{ if (!$input) { diff --git a/Lib/csharp/csharp.swg b/Lib/csharp/csharp.swg index d4bcd3c80..94e0458a6 100644 --- a/Lib/csharp/csharp.swg +++ b/Lib/csharp/csharp.swg @@ -409,7 +409,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { #endif %typemap(directorin) SWIGTYPE -%{ $input = (void *)new $1_ltype((const $1_ltype &)$1); %} +%{ $input = (void *)new $1_ltype(SWIG_STD_MOVE($1)); %} %typemap(csdirectorin) SWIGTYPE "new $&csclassname($iminput, true)" %typemap(csdirectorout) SWIGTYPE "$&csclassname.getCPtr($cscall).Handle" |