Test operator pointer casts
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9537 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
8c2b66a11d
commit
23311ef735
1 changed files with 20 additions and 1 deletions
|
|
@ -39,13 +39,32 @@
|
||||||
};
|
};
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%rename(OpInt) operator int;
|
%rename(OpInt) operator int();
|
||||||
|
%rename(OpIntStarStarConst) operator int **() const;
|
||||||
|
%rename(OpIntAmp) operator int &();
|
||||||
|
%rename(OpIntStar) operator void *();
|
||||||
|
%rename(OpConstIntIntStar) operator const int *();
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
class Ops {
|
class Ops {
|
||||||
public:
|
public:
|
||||||
|
Ops() : num(0) {}
|
||||||
virtual ~Ops() {}
|
virtual ~Ops() {}
|
||||||
virtual operator int() { return 0; }
|
virtual operator int() { return 0; }
|
||||||
|
virtual operator int **() const {
|
||||||
|
return (int **) 0;
|
||||||
|
}
|
||||||
|
virtual operator int &() {
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
virtual operator void *() {
|
||||||
|
return (void *) this;
|
||||||
|
}
|
||||||
|
virtual operator const int *() {
|
||||||
|
return #
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
int num;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Prims {
|
struct Prims {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue