This is a list of C++ operators that can be overloaded and their normal signatures(a.k.a what an int would do). The order is the preffered order to use them(The first one listed is often preffered)
- free function ->
T operator+( T const & lhs, T const & rhs )
- member function ->
T operator+( T const & rhs ) const
- member function ->
T operator+( ) const
- free function ->
T & operator+( T & value )
- member function ->
T & operator+=( T const & rhs )
- free function ->
T & operator+=( T & lhs, T const & rhs )
- member function ->
T & operator++( )
-> prefix ++T - member function ->
T operator++( int )
-> postfix T++ - free function ->
T & operator++( T & value )
-> prefix ++T - free function ->
T operator++( T & value, int )
-> postfix T++
- free function ->
T operator-( T const & lhs, T const & rhs )
- member function ->
T operator-( T const & rhs ) const
- member function ->
T operator-( ) const
- free function ->
T operator-( T const & value )
- free function ->
T & operator-=( T & lhs, T const & rhs )
- member function ->
T & operator-=( T const & rhs )
- member function ->
T & operator--( )
-> prefix --T - member function ->
T operator--( int )
-> postfix T-- - free function ->
T & operator--( T & value )
-> prefix --T - free function ->
T operator--( T & value, int )
-> postfix T--
- free function ->
T operator*( T const & lhs, T const & rhs )
- member function ->
T operator*( T const & rhs ) const
- free function ->
T & operator*=( T & lhs, T const & rhs )
- member function ->
T & operator*=( T const & rhs )
- free function ->
T operator/( T const & lhs, T const & rhs )
- member function ->
T operator/( T const & rhs ) const
- free function ->
T & operator/=( T & lhs, T const & rhs )
- member function ->
T & operator/=( T const & rhs )
- free function ->
T operator%( T const & lhs, T const & rhs )
- member function ->
T operator%( T const & rhs ) const
- free function ->
T & operator%=( T & lhs, T const & rhs )
- member function ->
T & operator%=( T const & rhs )
- free function ->
T operator<<( T const & lhs, size_t pos )
- member function ->
T operator<<( size_t pos ) const
- free function ->
T & operator<<=( T & lhs, size_t pos )
- member function ->
T & operator<<=( size_t pos )
- free function ->
T operator>>( T const & lhs, size_t pos )
- member function ->
T operator<<( size_t pos ) const
- free function ->
T & operator>>=( T & lhs, size_t pos )
- member function ->
T & operator<<=( size_t pos )
- free function ->
T operator|( T const & lhs, T const & rhs )
- member function ->
T operator|( T const & rhs ) const
- free function ->
T & operator|=( T & lhs, T const & rhs )
- member function ->
T & operator|=( T const & rhs )
- free function ->
T operator&( T const & lhs, T const & rhs )
- member function ->
T operator&( T const & rhs ) const
- free function ->
T & operator&=( T & lhs, T const & rhs )
- member function ->
T & operator&=( T const & rhs )
- free function ->
T operator^( T const & lhs, T const & rhs )
- member function ->
T operator^( T const & rhs ) const
- member function ->
T & operator^=( T const & rhs )
- free function ->
T & operator^=( T & lhs, T const & rhs )
- member function ->
T operator~( ) const
- free function ->
T operator~( T const & value )
- free function ->
bool operator==( T const & lhs, T const & rhs )
- member function ->
bool operator==( T const & rhs ) const
- free function ->
bool operator!=( T const & lhs, T const & rhs )
- member function ->
bool operator!=( T const & rhs ) const
- free function ->
bool operator<( T const & lhs, T const & rhs )
- member function ->
bool operator<( T const & rhs ) const
- free function ->
bool operator<=( T const & lhs, T const & rhs )
- member function ->
bool operator<=( T const & rhs ) const
- free function ->
bool operator>( T const & lhs, T const & rhs )
- member function ->
bool operator>( T const & rhs )
- free function ->
bool operator>=( T const & lhs, T const & rhs )
- member function ->
bool operator>=( T const & rhs ) const
- free function ->
bool operator&&( T const & lhs, T const & rhs )
- member function ->
bool operator&&( T const & rhs ) const
- free function ->
bool operator||( T const & lhs, T const & rhs )
- member function ->
bool operator||( T const & rhs ) const
- member function ->
bool operator!( ) const
- free function ->
bool operator!( T const & value ) const
- See p0515 paper
- member function ->
T * operator->( )
- member function ->
T const * operator->( ) const
also T * is normal
- member function ->
T & operator*( )
- member function ->
T const & operator*( ) const
- member function ->
T & operator[]( size_t pos )
> pos can be any single argument type - member function ->
T const & operator[]( size_t pos ) const
> pos can be any single argument type
- free function ->
Anything operator->( Anything lhs, Anything rhs )
- member function ->
Anything operator( )( Anything... args )
- Please don't :)
- member function ->
Anything operator,( Anything )
- free function ->
Anything operator,( Anything lhs, Anything rhs )
- Please don't :)
- member function ->
T * operator&( )
- member function ->
T const * operator&( ) const
or T*
- member function -> From a type T ->
operator U( ) const
- free function ->
std::ostream & operator<<( std::ostream & os, T const & value )
- free function ->
std::istream & operator>>( std::istream & is, T & value )
You're missing the dreaded
operator=
(assignment operator).Major omission, to me, as that is the one I always have to look up 😂