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
|
|
@ -35,7 +35,7 @@ class string;
|
|||
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
|
||||
return $null;
|
||||
}
|
||||
$1 = std::string($input); %}
|
||||
$1.assign($input); %}
|
||||
%typemap(out) string %{ $result = SWIG_csharp_string_callback($1.c_str()); %}
|
||||
|
||||
%typemap(directorout, canthrow=1) string
|
||||
|
|
@ -43,7 +43,7 @@ class string;
|
|||
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
|
||||
return $null;
|
||||
}
|
||||
$result = std::string($input); %}
|
||||
$result.assign($input); %}
|
||||
|
||||
%typemap(directorin) string %{ $input = SWIG_csharp_string_callback($1.c_str()); %}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue