Lesson 18: Type Deduction and Definition in C++
What is type deduction? Let’s first look at a simple piece of code: #include <iostream> #include <vector> int main() { std::vector<int> numbers = {1, 2, 3, 4, 5}; auto it = numbers.begin(); while (it != numbers.end()) { std::cout << *it << " "; ++it; } return 0; } The auto keyword allows the compiler to … Read more