The tag has no wiki summary.

learn more… | top users | synonyms

16
votes
1answer
485 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: vector<int> ...
7
votes
1answer
245 views

Avoid duplicated += -= operator code

In C++ (and C++11), classes defining a + and += operators often define a - and -= operators that do nearly the same thing (except + is replaced with - in the function). What is the best way to avoid ...
6
votes
2answers
256 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: public T ...
4
votes
1answer
622 views

Custom operator new and operator delete

In our embedded application, we have to replace ::operator new and ::operator delete to call a special malloc(), to ensure that the memory is allocated correctly. The code, written with this guide in ...
4
votes
1answer
156 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 ...
3
votes
1answer
91 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: ...
2
votes
1answer
506 views

Get operator overload method for generics type

I would like to replace the following: class AdditionEngine<T> { public T DoAddition(T x, T y) { // use dynamic since the compiler doesn't allow x + y; dynamic u = x; ...
1
vote
1answer
445 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 ...