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++11: std::tuple

A tuple is a C++11 construction and it is built heavily on variadic templates. A tuple is a variadic class template that stores an unlimited set of values of different types, defined when instantiating the tuple; for example: tuple<int, int> x; will store 2 integers. tuple<string, int, bool> y; will store one string, one integer… Continue reading C++11: std::tuple

C++: Smart pointers, part 3: More on unique_ptr

This is the third post of several posts I wrote related to smart pointers: Smart pointers unique_ptr More on unique_ptr shared_ptr weak_ptr Ok, here I am going to write about two other features that unique_ptr has that I did not mention in my last post. unique_ptr default behavior consists on take ownership of a pointer… Continue reading C++: Smart pointers, part 3: More on unique_ptr