r/programming • u/meetingcpp • Apr 01 '13
Ten C++11 Features Every C++ Developer Should Use
http://www.codeproject.com/Articles/570638/Ten-Cplusplus11-Features-Every-Cplusplus-Developer
469
Upvotes
r/programming • u/meetingcpp • Apr 01 '13
2
u/snk_kid Apr 02 '13 edited Apr 02 '13
I think he/she is referring to the fact that lambda expressions in C++11 can not be recursively defined, this is not possible:
auto fib = &fib {return n < 2 ? 1 : fib (n-1) + fib (n-2)};
So you have to use a library abstraction like std::function to achieve this, also by default this uses heap-allocation unless you provide a customer allocator in the second parameter of std::function, a pure lambda expression assigned to a type-infered name (auto x = {...};) is stack allocated.