Comparison operators
From Cppreference
Accesses a member of an object.
Operator name | Syntax | Over​load​able | Prototype examples (for class T) | |
---|---|---|---|---|
Inside class definition | Outside class definition | |||
array subscript | a[b] | Yes | R T::operator[](const T2 &b); | N/A |
indirection (variable pointed to by a) | *a | Yes | R& T::operator*(); | R& operator(T &a); |
address of | &a | Yes | R* T::operator&(); | R* operator&(T &a); |
member of object | a.b | No | N/A | N/A |
member of pointer | a->b | Yes | R* T::operator->() | N/A |
pointer to member of object | a.*b | No | N/A | N/A |
member of pointer | a->b | Yes | R* T::operator->*(R) | R* T::operator->*(T, R) |
|
[edit] Explanation
array subscript operator provides access to the elements in the internal array
indirection, member of pointer and pointer to member of pointer operators provide provide pointer semantics for any object.
member of pointer and pointer to member of pointer operators return a pointer to the actual object which will be used for member access.
[edit] See also
Common operators | ||||||
---|---|---|---|---|---|---|
assignment | increment decrement |
arithmetic | logical | comparison | member access |
other |
a = b a = rvalue |
++a --a |
+a -a |
!a a && b |
a == b a != b |
a[b] *a |
a(...) a, b |
Special operators | ||||||
static_cast converts one type to another compatible type |