Are the rules clear to you?
Getting your head around auto’s type-deduction rules
by Glennan Carnie
From the article:
Automatic type-deduction is perhaps one of the more divisive features of Modern C++. At its core it’s a straightforward concept: let the compiler deduce the type of an object from its initialiser. Used in the right way this can improve the readability and maintainability of your code.
However, because auto is based on template type-deduction rules there are some subtleties that can catch the unwary programmer.
In this article we’ll have a look at auto in the context of the template type-deduction rules to see where all these subtleties come from...
Add a Comment
Comments are closed.