Where can one find a list o开发者_如何学Gof the function signatures for all operator overloads?
Wikipedia: Operators in C and C++.
ISO/IEC 14882:2003 §13.5, Overloaded Operators
It's not quite as useful as the Wikipedia list if you don't have a copy of the document, but it has the benefit of being authoritative.
You can also consult the latest draft of C++0x, N3126, §13.5, Overloaded Operators.
You can find them on cppreference, divided by operator cagetory:
- Assignment operators:
a=b,a+=b,a-=b,a*=b,a/=b,a%=b,a&=b,a|=b,a^=b,a<<=b,a>>=b - Increment and decrement:
++a,--a,a++,a-- - Arithmetic operators:
+a,-a,a+b,a-b,a*b,a/b,a%b,~a,a&b,a|b,a^b,a<<b,a>>b - Logical operators:
a||b,a&&b,!a - Comparison operators:
a==b,a!=b,a<b,a>b,a<=b,a>=b,a<=>b(C++20) - Member access operators:
a[b],*a,&a,a->b,a.b,a->*b,a.*b - Other operators:
a(...),a,b,a?b:c
I suggest to check the Canonical implementations in the operator overloading page.
In the book: "Thinking in C++, 2nd ed. Volume 1" by Bruce Eckel
You can read it online. The chapter you are looking for (chapter 12), can be found here, for example.
加载中,请稍侯......
精彩评论