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.

Why doesn't `std::initializer_list` provide a subscript operator?

Suppose that you are writing a function that accepts an std::initializer_list called list, and that the function requires …

c++ c++11 iterator operator-overloading initializer-list
Overloading equivalence (==) operator for custom class in Swift

Is it possible to overload equivalence (==) operator for a custom class inside that custom class. However I know that it …

ios swift operator-overloading equivalence
Why would anyone want to overload the & (address-of) operator?

Possible Duplicate: What legitimate reasons exist to overload the unary operator& ? I just read this question, and I can't …

c++ operator-overloading overloading address-operator
Overloading the subscript operator "[ ]" in the l-value and r-value cases

I have overloaded [] operator in my class Interval to return minutes or seconds. But I am not sure how to …

c++ operator-overloading subscript-operator
Operator overloading and namespaces

Possible Duplicate: Where should non-member operator overloads be placed? While browsing on SO, I often find questions or answer that …

c++ namespaces operator-overloading operator-keyword
Why == overloading can access private members of argument

Possible Duplicate: why private value of the obj can be changed by class instance? Consider the following (partial) code: class …

c++ operator-overloading access-specifier
Why is it possible to place friend function definitions inside of a class definition?

Is it not supposed for a friend function to be explicitly defined outside of a class ? If so why can …

c++ operator-overloading friend
Could I use operator == if I only implemented operator <?

I have implemented operator< for a certain object. Logically, if !(a < b) and !(b < a) it means …

c++ operator-overloading
Can't std::ostream output a const char array?

For the fun and experience of it, I'm modifying and exploring the source code for Blobby Volley 2 1.0 (Linux). Well... I …

c++ operator-overloading ostream
Implementing operator< in C++

I have a class with a few numeric fields such as: class Class1 { int a; int b; int c; public: // …

c++ operators operator-overloading operator-keyword