As we know the compiler generates different lambda types for different lambdas even if they are exactly the same:

auto lambda1 =[](){};

auto lambda2 =[](){};

std::cout <<typeid(decltype(lambda1)).name()<<'\n';

std::cout <<typeid(decltype(lambda2)).name()<<'\n';

This produces different results. Its implementation specific so it varies between compilers. However sometimes we want to put lambdas in a container and do something. We can use std::function and type erase them but it has some overhead (havent researched what exactly but I will, stay tuned).

So the trick here is to use a helper function that returns a lambda:

auto make_f =[](int multiplyer ) {

return[multiplyer](constint& i){

return i * multiplyer;

};

};

autoFuncs= std::vector<decltype(make_f(0))>();

Funcs.push_back(make_f(1));

Funcs.push_back(make_f(2));

This way we force the compiler to lock the lambda type because the return type of make_f must always be the same.

2. Table of parallel algorithms in C++17

This week infographic/picture/printable is the parallel algorithms in the Standard Library that are coming with C++17:

We can add to Sean Parent recommendation "No raw loops" - "Know the STL algorithms [and which ones are parallelizable]"3. std::applystd::apply is introduced in C++17 and allows us to pass a tuple’s elements as function arguments. Since it is very easy to create tuples from variadics this is useful utility.

template<class F,classTuple>

constexprdecltype(auto) apply(F&& f,Tuple&& t);

A possible implementation looks like this (I found it on the internet and cant remember where, apologies for stealing):

Boost.MultiIndexcontainer is a powerful container that maintains one or more indices with different sorting and access semantics(as the name suggests). At first glance it can be very strange and hard looking but when you use it several times you get used to it and may experience that how-did-I-lived-without-this moment.

I'll give as example one often occurring case - bidirectional map. You can find the full working example at boost tutorials.