When wrapping C++ code, generate code which uses
std::string::assign(PTR, LEN) rather than assigning std::string(PTR, LEN). Using assign generates more efficient code (tested with GCC 4.1.2). git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9936 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
ef4ca158de
commit
c836c81acb
11 changed files with 46 additions and 45 deletions
|
|
@ -36,7 +36,7 @@ class wstring;
|
|||
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0);
|
||||
return $null;
|
||||
}
|
||||
$1 = std::wstring($input); %}
|
||||
$1.assign($input); %}
|
||||
%typemap(out) wstring %{ $result = SWIG_csharp_wstring_callback($1.c_str()); %}
|
||||
|
||||
%typemap(directorout, canthrow=1) wstring
|
||||
|
|
@ -44,7 +44,7 @@ class wstring;
|
|||
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0);
|
||||
return $null;
|
||||
}
|
||||
$result = std::wstring($input); %}
|
||||
$result.assign($input); %}
|
||||
|
||||
%typemap(directorin) wstring %{ $input = SWIG_csharp_wstring_callback($1.c_str()); %}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue