Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can one find a list of operator overloads?

Where can one find a list of the function signatures for all operator overloads?

like image 509
darven Avatar asked Oct 04 '10 20:10

darven


3 Answers

Wikipedia: Operators in C and C++.

like image 127
Potatoswatter Avatar answered Sep 23 '22 03:09

Potatoswatter


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.

like image 37
James McNellis Avatar answered Sep 26 '22 03:09

James McNellis


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.

like image 28
Paolo Fulgoni Avatar answered Sep 22 '22 03:09

Paolo Fulgoni