Visual Studio fix for 'operator or' and workaround for binary and unary operator- confusion
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8365 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
7f05256bb7
commit
a8d7fb3955
1 changed files with 10 additions and 1 deletions
|
|
@ -68,6 +68,10 @@ see bottom for a set of possible tests
|
|||
|
||||
%inline %{
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#include <iso646.h> /* for named logical operator, eg 'operator or' */
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
class Op{
|
||||
|
|
@ -94,7 +98,7 @@ public:
|
|||
// the +,-,*,... are friends
|
||||
// (just to make life harder)
|
||||
friend Op operator+(const Op& a,const Op& b){return Op(a.i+b.i);}
|
||||
friend Op operator-(const Op& a,const Op& b){return Op(a.i-b.i);}
|
||||
friend Op operator-(const Op& a,const Op& b);
|
||||
friend Op operator*(const Op& a,const Op& b){return Op(a.i*b.i);}
|
||||
friend Op operator/(const Op& a,const Op& b){return Op(a.i/b.i);}
|
||||
friend Op operator%(const Op& a,const Op& b){return Op(a.i%b.i);}
|
||||
|
|
@ -140,6 +144,11 @@ inline bool operator>=(const Op& a,const Op& b){return a.i>=b.i;}
|
|||
|
||||
%}
|
||||
|
||||
%{
|
||||
// This one is not declared inline as VC++7.1 gets mixed up with the unary operator-
|
||||
Op operator-(const Op& a,const Op& b){return Op(a.i-b.i);}
|
||||
%}
|
||||
|
||||
// in order to wrapper this correctly
|
||||
// we need to extend the class
|
||||
// to make the friends & non members part of the class
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue