Lambdas in C++11

This post has been created more than 3 months ago. It might contain inaccurate or stale (or both!) information. Use with caution!

Lambda expressions have been introduced to C++ with the most recent standard, presented in Section [expr.prim.lambda]. They allow the creation of simple functions without giving them a name. What are they good for? Being simple is not really the point here; the most useful case that I have found in my limited experience has been as a convenient replacement for Functors (also known as Function objects).

In this post, I’ll give a quick introduction to how to use lambdas in your code. In the next installment, I will discuss a small example of functor, and will show side by side a piece of code with functors and its substitution with a clean lambda.

Read More

Write an Interface between your Program and a Shared Object

This post has been created more than 3 months ago. It might contain inaccurate or stale (or both!) information. Use with caution!

I wanted to share something I’ve been doing for some hours today, in the hope to understand it better. I also hope to receive criticism on this, because there might be a better way to do the same thing, only more elegantly. This is no research problem, as I am sure it has been solved time and again in different contexts; but the whole example, comprising all the pieces put together in this post, is something I have not seen around, and I think it can be of some service if I explain it.

Read More

Exploring the Boost Graph Library

This post has been created more than 3 months ago. It might contain inaccurate or stale (or both!) information. Use with caution!

Part 2

With this post I’m starting a series about the Boost Graph Library (BGL). My objective is to present the material in small, easy-to-digest chunks, in order to build an understanding of this library and of the C++ concepts that it uses.

Read More