Top "Operator-overloading" questions

Operator overloading is a feature of a programming language that allows custom implementations for operators depending on the types of the operands involved.

overloading assignment operator With subscript operator

I overloaded both subscript operator and assignment operator and I am trying to get right value to assignment operator example …

c++ operator-overloading overloading assignment-operator subscript
Correct use of `= delete` for methods in classes

Is the following snipplet correct for un-defining all otherwise generated methods and constructors for a class? struct Picture { // 'explicit': no …

c++ c++11 operator-overloading move-semantics rvalue-reference
Compound assignment and add operator overloading

I need help with both of my operator overloading functions presented below. I'm unsure of how I can implement this …

c++ string operator-overloading compound-assignment
Overload operators as member function or non-member (friend) function?

I am currently creating a utility class that will have overloaded operators in it. What are the pros and cons …

c++ function operator-overloading friend
ifstream's operator>> to detect end of line?

I have an irregular list where the data look like this: [Number] [Number] [Number] [Number] [Number] [Number] [Number] [Number] [Number] […

c++ parsing operator-overloading ifstream istream
Why/When in Python does `x==y` call `y.__eq__(x)`?

The Python docs clearly state that x==y calls x.__eq__(y). However it seems that under many circumstances, the …

python comparison operator-overloading
c++ two versions of overloading subscript operator

My question is about the difference between: const T& operator[](const int nIndex) const; and: T& operator[](const …

c++ operator-overloading subscript
‘CGFloat’ is not convertible to ‘UInt8' and other CGFloat issues with Swift and Xcode 6 beta 4

In case this illuminates the problem, here's the original Objective-C code. int x = (arc4random()%(int)(self.gameView.bounds.size.…

xcode swift type-conversion operator-overloading cs193p
Why does the postfix increment operator take a dummy parameter?

Have a look at these function signatures: class Number { public: Number& operator++ (); // prefix ++ Number operator++ (int); // postfix ++ }; Prefix doesn't …

c++ operator-overloading language-design prefix postfix-operator
Why can some operators only be overloaded as member functions, other as friend functions and the rest of them as both?

Why can some operators only be overloaded as member functions, other as non-member "free" functions and the rest of them …

c++ class operator-overloading member-functions