feat: test auto keyword
This commit is contained in:
parent
b78b86742b
commit
9b20fc7126
4 changed files with 28 additions and 2 deletions
14
chapters/chapter_02/src/type_inference.cpp
Normal file
14
chapters/chapter_02/src/type_inference.cpp
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include "type_inference.h"
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
void TypeInferenceTest::run() {
|
||||
|
||||
const std::vector<int> int_vec = {1, 2, 3, 4, 5};
|
||||
|
||||
std::cout << "vector iterator with auto: ";
|
||||
for (auto it = int_vec.cbegin(); it != int_vec.cend(); ++it) {
|
||||
std::cout << *it << " ";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue