关于运算符优先级可以用以下代码测试。
重载运算符不会改变其优先级。
#include<cstdio>
#include<algorithm>
using namespace std;
struct test{}s;
test operator! (const test&){return printf("! "),s;}
test operator~ (const test&){return printf("~ "),s;}
test &operator++(const test&){return printf("++a "),s;}
test &operator--(const test&){return printf("--a "),s;}
test operator++ (const test&,int){return printf("a++ "),s;}
test operator-- (const test&,int){return printf("a-- "),s;}
test operator* (const test&,const test&){return printf("* "),s;}
test operator/ (const test&,const test&){return printf("/ "),s;}
test operator% (const test&,const test&){return printf("% "),s;}
test operator+ (const test&,const test&){return printf("+ "),s;}
test operator- (const test&,const test&){return printf("- "),s;}
test operator<< (const test&,const test&){return printf("<< "),s;}
test operator>> (const test&,const test&){return printf(">> "),s;}
test operator< (const test&,const test&){return printf("< "),s;}
test operator> (const test&,const test&){return printf("> "),s;}
test operator<= (const test&,const test&){return printf("<= "),s;}
test operator>= (const test&,const test&){return printf(">= "),s;}
test operator== (const test&,const test&){return printf("== "),s;}
test operator!= (const test&,const test&){return printf("!= "),s;}
test operator& (const test&,const test&){return printf("& "),s;}
test operator^ (const test&,const test&){return printf("^ "),s;}
test operator| (const test&,const test&){return printf("| "),s;}
test operator&& (const test&,const test&){return printf("&& "),s;}
test operator|| (const test&,const test&){return printf("|| "),s;}
test operator+= (const test&,const test&){return printf("+= "),s;}
test operator-= (const test&,const test&){return printf("-= "),s;}
test operator*= (const test&,const test&){return printf("*= "),s;}
test operator/= (const test&,const test&){return printf("/= "),s;}
test operator%= (const test&,const test&){return printf("%= "),s;}
test operator&= (const test&,const test&){return printf("&= "),s;}
test operator|= (const test&,const test&){return printf("|= "),s;}
test operator^= (const test&,const test&){return printf("^= "),s;}
test operator<<=(const test&,const test&){return printf("<<= "),s;}
test operator>>=(const test&,const test&){return printf(">>= "),s;}
int main(){
test a,b,c;
a-=(a--)-(--a);
}