Tutorial by Examples

This example shows the basic type inferences the compiler can perform. auto a = 1; // a = int auto b = 2u; // b = unsigned int auto c = &a; // c = int* const auto d = c; // d = const int* const auto& e = b; // e = const unsigned int& auto x = a...
The data type auto keyword is a convenient way for programmers to declare lambda functions. It helps by shortening the amount of text programmers need to type to declare a function pointer. auto DoThis = [](int a, int b) { return a + b; }; // Do this is of type (int)(*DoThis)(int, int) // e...
This example shows how auto can be used to shorten type declaration for for loops std::map<int, std::string> Map; for (auto pair : Map) // pair = std::pair<int, std::string> for (const auto pair : Map) // pair = const std::pair<int, std::string> for (c...

Page 1 of 1