Fix wrapping of function pointers and member function pointers when the function returns by reference
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12157 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
2d8b51684d
commit
568607c5ea
7 changed files with 67 additions and 4 deletions
|
|
@ -99,3 +99,29 @@ double (Shape::*perimetervar)(void) = &Shape::perimeter;
|
|||
%constant double (Shape::*PERIMPT)(void) = &Shape::perimeter;
|
||||
%constant double (Shape::*NULLPT)(void) = 0;
|
||||
|
||||
/*
|
||||
%inline %{
|
||||
struct Funktions {
|
||||
void retByRef(int & (*d)(double)) {}
|
||||
};
|
||||
void byRef(int & (Funktions::*d)(double)) {}
|
||||
%}
|
||||
*/
|
||||
|
||||
%inline %{
|
||||
|
||||
struct Funktions {
|
||||
int addByValue(const int &a, int b) { return a+b; }
|
||||
int * addByPointer(const int &a, int b) { static int val; val = a+b; return &val; }
|
||||
int & addByReference(const int &a, int b) { static int val; val = a+b; return val; }
|
||||
};
|
||||
|
||||
int call1(int (Funktions::*d)(const int &, int), int a, int b) { Funktions f; return (f.*d)(a, b); }
|
||||
int call2(int * (Funktions::*d)(const int &, int), int a, int b) { Funktions f; return *(f.*d)(a, b); }
|
||||
int call3(int & (Funktions::*d)(const int &, int), int a, int b) { Funktions f; return (f.*d)(a, b); }
|
||||
%}
|
||||
|
||||
%constant int (Funktions::*ADD_BY_VALUE)(const int &, int) = &Funktions::addByValue;
|
||||
%constant int * (Funktions::*ADD_BY_POINTER)(const int &, int) = &Funktions::addByPointer;
|
||||
%constant int & (Funktions::*ADD_BY_REFERENCE)(const int &, int) = &Funktions::addByReference;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue