fix directorout typemap for const std::string&. Adding warning about the new typemap, which is not thread safe
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6872 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
89bdd6f63b
commit
c98340f0a7
7 changed files with 73 additions and 5 deletions
36
Examples/test-suite/director_string.i
Normal file
36
Examples/test-suite/director_string.i
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
%module(directors="1") director_string;
|
||||
%include stl.i
|
||||
%include std_vector.i
|
||||
%include std_string.i
|
||||
|
||||
// Using thread unsafe wrapping
|
||||
%warnfilter(470) A;
|
||||
|
||||
%{
|
||||
#include <vector>
|
||||
#include <string>
|
||||
%}
|
||||
|
||||
%feature("director") A;
|
||||
%inline %{
|
||||
|
||||
struct A
|
||||
{
|
||||
A(const std::string& first)
|
||||
: m_strings(1, first)
|
||||
{}
|
||||
|
||||
virtual ~A() {}
|
||||
|
||||
virtual const std::string& get_first() const
|
||||
{ return get(0); }
|
||||
|
||||
virtual const std::string& get(int n) const
|
||||
{ return m_strings.at(n); }
|
||||
|
||||
std::vector<std::string> m_strings;
|
||||
};
|
||||
|
||||
%}
|
||||
|
||||
%template(StringVector) std::vector<std::string>;
|
||||
Loading…
Add table
Add a link
Reference in a new issue