C++: “auto” return type deduction

Before C++14, when implementing a function template you did not know the return type of your functions, you had to do something like this: You had to use "decltype" in order to say the compiler: "The return type of this method is the return type of method do_something of object a". The "auto" keyword used… Continue reading C++: “auto” return type deduction

Advertisements

C++: “auto” on anonymous functions

C++14 introduced an improvement to the way we can declare anonymous functions (a.k.a. lambda expressions). For example, before C++14, if you wanted to pass an anonymous function to the sort algorithm, you had to do something like this: Since C++14, you can let the compiler to deduce the type of the variables passed as parameters… Continue reading C++: “auto” on anonymous functions