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:
William S Fulton 2006-01-10 23:48:08 +00:00
commit a8d7fb3955

View file

@ -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