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.

"no 'operator++(int)' declared for postfix '++' [-fpermissive]" on enums

I have got the enum enum ProgramID { A = 0, B = 1, C = 2, MIN_PROGRAM_ID = A, MAX_PROGRAM_ID = C, } CurrentProgram; Now, …

c++ gcc enums operator-overloading avr
Inheriting and overriding ostream operator in C++

I've been trying to find an answer to this, but no one seems to have exactly the same problem as …

c++ inheritance operator-overloading ostream
How should I write ISO C++ Standard conformant custom new and delete operators?

How should I write ISO C++ standard conformant custom new and delete operators? This is in continuation of Overloading new …

c++ operator-overloading new-operator c++-faq delete-operator
Can I define custom operator overloads in Javascript?

Is it possible to define custom operators between instances of a type in JavaScript? For example, given that I have …

javascript vector operator-overloading dsl equality
Define method aliases in Python?

I have a vector class and I defined the __mul__ method to multiply a vector by a number. Here is …

python class operator-overloading overriding operator-keyword
Why should the assignment operator return a reference to the object?

I'm doing some revision of my C++, and I'm dealing with operator overloading at the minute, specifically the "="(assignment) operator. …

c++ operator-overloading return-type assignment-operator
"More than one operator + matches these operands" error

I'm creating a Money class for a school assignment. I've defined a conversion from Money to double, I have a …

c++ operator-overloading type-conversion implicit-conversion explicit-constructor
Is there actually a reason why overloaded && and || don't short circuit?

The short circuiting behaviour of the operators && and || is an amazing tool for programmers. But why do they …

c++ c++11 operator-overloading logical-operators short-circuiting
C++ user-defined conversion operators without classes?

In C++ is it possible to define conversion operators which are not class members? I know how to do that …

c++ operator-overloading coercion
Can I add an implicit conversion for two classes which I don't directly control?

I'd like to be able to implicitly convert between two classes which are otherwise incompatible. One of the classes is …

c# f# operator-overloading extension-methods implicit-conversion