3 ms·
If you're using a type like that repeatedly then it probably deserves an alias.
by idle_zealot 3y ago
If you're using a type like that repeatedly then it probably deserves an alias.
- TillE 3y agoEvery time you want to iterate over a map, for example, you're using std::pair<T,U> or std::unordered_map<T,U>::iterator. This gets very annoying without auto, and making an alias doesn't really address any of the complaints the article has.
- Supermancho 3y agoThe issues around type inference could be an annotation (extra overhead) on a function or line to enable some form of it, for simplicity of mapping or conversion, but leave it out by default. Now you get the best of both worlds.
- wredue 3y agoAliases have their own problems. You may have to propagate the alias, or define different aliases with the same type all over the place. Then you have issues with changing code. Complex composed types just have this issue to be honest, and personally I like having inference as a tool to avoid the litter.