|
|
|
|
|
by stinos
4484 days ago
|
|
Maybe for programmers that are only used to reading C, pre-C++11 and the likes. On the other hand when you are used to read more dynamic languages where typenames are much less written down literally (say C#/Python/Matlab just to name what comes up in my head), it doesn't make much difference. I'm also not sure if it makes that much of a difference for templates? Those are already quite type-agmostic. E.g. if your template typename is T, there's not much difference in writing `auto x = T()` vs `T x = T()`. Except the (imo) improvement that you are not repeating yourself in the auto case. |
|
And certainly - the case of auto x = T(); is not too bad. It's when the type is determined by template overload, or Koenig lookup, or template traits, that it becomes murky. It will take years for tool to catch up - now when I put my cursor on a variable, it will show me the type in the status bar. For the first few years this will always show 'auto' I'm afraid. In other languages, a collection is a collection (mostly) - in C++ it depends on whether you use a vector, set, hash or list what methods are available. That's quite a difference, from a programming comfort point of view.