auto keyword was introduced to simplify the code. In particular, iterating over stl containers became way easier and better-looking without having to use the ugly std::vector<MyType>::iterator syntax every time you want to loop over it. However, it was still possible to write code without using auto which would do exactly the same thing.
Now (I think) you can't use certain features without auto, in particular structured bindings:
std::tuple<int, int&> f();
auto [x, y] = f();
So, two questions:
- Am I correct that there's no way to initialize
[x, y]without usingauto(still using structured bindings)? Is there a way to initialize it explicitly:*explicit_type* [x, y] = f();? - What other features require using
auto?