cplusplus.co.il

Archive for February 2010

The possibility of overloading just about any C++ operator and having it do something entirely different from what it was designed for, can sometimes make life pretty hard.

Here are a couple of examples: What if you wanted to take the address of an object, which had implemented an entirely different semantic for the ampersand (&) operator? Or what if somebody decided to overload the comma operator in some strange manner?

As you could have guessed, there are solutions for such scenarios.

Read the rest of this entry »

My name is Nadav Rotem and I am a guest blogger on this blog. I am here to write about metalists. Not metalists like Metallica or Iron Maiden, but meta-lists. Lists which are “template maiden”.

The First thing I am going to show you is how to create a data structure which is similar to a linked list. Next we are going to define the Push, Pop and Concat operations. After we have those, we will implement the Walsh transform (similar to FFT on integers) on our list. After that, we will use template templates to define generators to create lists. Finally we are going to implement the Map and Reduce operations on our lists. Let’s start.

Read the rest of this entry »