A C++ implementation of some of the programming-pearls (for reuse later)