Operator overloading is a feature of some programming languages that allows custom implementations for operators depending on the types of the operands involved. Some languages allow new operators to be defined while others only allow redefinition of existing ones.

learn more… | top users | synonyms

5
votes
2answers
102 views

Overloading operators in PhoneCall class

I am trying to understand the concepts of friend functions, overloaded operators, and inheritance in C++. I am very confused on the specifics used for coding, since ...
2
votes
0answers
38 views

Grails overloaded controller workaround

I had an overloaded method, but Grails doesn't allow overloaded methods in controller actions. The overloaded method looked like this: ...
3
votes
1answer
99 views

Review of 2d Vector class

I'll keep this short. I've never actually done professional C++. I don't really know any of the 'best practices'. I'd like to get some review on a simple class that I've made. My Vector2d.h file: ...
6
votes
2answers
452 views

Improvement requested for: Generic Calculator and Generic Number

.NET does not support generic numbers. It is not possible to enforce a generic method with generic argument T that T is a number. The following code will simply not compile: ...
23
votes
1answer
748 views

Named operators in C++

A post by Yakk alerted me to the idea of named operators in C++. This look splendid (albeit very unorthodox). For instance, the following code can be made to compile trivially: ...
4
votes
1answer
179 views

Implementing C++ boolean function objects with logical operator combinations

I want to make a C++ object hierarchy of "classifiers", which can be composed together via logical operators into a single classifier that implements the whole logical combination. This is actually ...
7
votes
1answer
262 views

Avoid duplicated += -= operator code

In C++ (and C++11), classes defining a + and += operators often define a - and ...
2
votes
1answer
779 views

Get operator overload method for generics type

I would like to replace the following: ...
1
vote
1answer
563 views

Extending string mapping

Basically I'm trying to generalise and extend the notion of mapping one string into another. There are two methods I often find myself using for this: Functions, and Dictionairies. So here are my 3 ...
4
votes
1answer
933 views

Custom operator new and operator delete

In our embedded application, we have to replace ::operator new and ::operator delete to call a special ...