I'm struggling to come up with some consistent rules for myself for when to use 'auto' in a C++ program. Here are my pro/con lists, perhaps you can help me by giving me your input.
Pro:
'auto' is good for avoiding complex and large template declarations (e.g. the classic use case of auto to define the iteration variable over an STL container)
'auto' is good for future-proofing code. For example, if I have an array of ints and I want to change it to unsigned ints, if I've used 'auto' when I refer to elements of that array, things will automatically update. Of course, that would also have occurred had I used a typedef for the array.
Cons:
'auto' makes it hard to read code. I have no idea if the declaration is a pointer or value. I have no idea if it might have a constructor and destructor.
'auto' makes me lazy. I can forget about the types and just write code. But in C++, the types are very important to the semantics of the program.
When does you guys use Auto? and when do you prefer not to use it?