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 is this ambiguity here?

Consider I have the following minimal code: #include <boost/type_traits.hpp> template<typename ptr_t> …

c++ templates operator-overloading
Calling a const function rather than its non-const version

I tried to wrap something similar to Qt's shared data pointers for my purposes, and upon testing I found out …

c++ operator-overloading constants overload-resolution const-method
Compare two objects with "<" or ">" operators in Java

How to make two objects in Java comparable using "<" or ">" e.g. MyObject<String> obj1= new …

java object operator-overloading comparable
Strange "Member function not viable" error in templated linear algebra vector class

I'm implementing a templated vector class (not the data container, but the vector in the linear algebra sense), and I'm …

c++ vector operator-overloading copy-constructor deep-copy
How can it be useful to overload the "function call" operator?

I recently discovered that in C++ you can overload the "function call" operator, in a strange way in which you …

c++ operator-overloading functor function-object
Two square bracket overloading

I am writing a matrix class in c++ and trying to overload some operator like = and >> and <&…

c++ indexing operator-overloading brackets
How to overload |= operator on scoped enum?

How can I overload the |= operator on a strongly typed (scoped) enum (in C++11, GCC)? I want to test, set …

c++ c++11 enums operator-overloading bitwise-operators
C++ template friend operator overloading

What is wrong with my code? template<int E, int F> class Float { friend Float<E, F&…

c++ templates operator-overloading friend
Can I overload an operator in Objective-C?

Is it possible to override operator use in Objective-C? For example myClassInstance + myClassInstance calls a custom function to add the …

objective-c operator-overloading
Namespaces and Operator Overloading in C++

When authoring a library in a particular namespace, it's often convenient to provide overloaded operators for the classes in that …

c++ operator-overloading namespaces