Recursively defined lambda functions in C++11

A neat feature, which was introduced in since C++11 is the ability to define a lambda functions[1] in combination with delegates represented by std::function[2]. The following exemplary code snippet demonstrates how a recursive lambda function can be constructed this way:

#include <functional>
#include <iostream>

int main () {
  std::function<void(int)> count_down;

  count_down = [&count_down] (int num) -> void {
    if (num > 0) {
      std::cout << "i:" << num << std::endl;
      count_down (num - 1);

  count_down (6);

Using GCC, the above code can be compiled with:

$ g++ testcase.cpp -o testcase --std=c++11


Quickly applying patches on Gentoo

Sometimes, it’s necessary to apply a patch for a given package and there is no time and no desire to fork an ebuild to a custom overlay. Luckily Gentoo provides an easy way to so. All you need to do is to place a patch into the directory /etc/portage/patches/[category]/[ebuild’s name]/new-fix.patch. Sadly, not all ebuilds in the portage tree has a build-in support for this feature and to be on the safe side you can put the following hook into the portage’s bashrc file:

# cat /etc/portage/bashrc 
post_src_prepare() {
    if type epatch_user &> /dev/null ; then

Reference: Gentoo wiki

Enabling multilib abi_x86_32 support on the stable Gentoo system

Currently the abi_x86_32 use flag is masked on the stable Gentoo system. Therefore turning the 32 option in the ABI_X86 variable, will not bring you further:

# cat /etc/portage/make.conf
ABI_X86="32 64"

and as a result the line

# emerge --ask --verbose --newuse --update --deep world

will show you an endless number of conflicts, which can not be directly resolved by portage. If you never the less wish to enable the 32 bit library support on your system, especially to make your 32 bit applications running well under wine, you should force the abi_x86_32 desired use flag. One of the possible solutions to achieve this would be:

# cat /etc/portage/profile/use.mask 

Moreover, more additional packages are required to have a full multilib featured support. Many of them has not been marked as stable yet. An up to date list of this packages at the moment of writing can be found here:

# cat /etc/portage/package.keywords/multilib


If emerge still has troubles to resolve all conflict, try to temporarily remove all emul-linux-x86-* ebuilds first, and all conflict should go away. Enjoy Gentoo!!!