News for hackers. Stuff that matters.
Re:Initialization in C++ is Seriously Bonkers by neutronicus on Saturday January 05, 2019 @06:33PM (#18835102)
Most pre-C++11 code I've seen that gets iterators from `begin()`, `end()`, and friends just typedef out their actual type anyways, so you the experience there is not that different from `auto`.
Re:Initialization in C++ is Seriously Bonkers by berkut on Saturday January 05, 2019 @06:44PM (#18835168)
But those typedefs almost always (in my experience) contain some indication of at the very least an abbreviation of the type and some hints as to whether it's a pointer or not.

That's a lot better to go on than "auto".

Re:Initialization in C++ is Seriously Bonkers by kllrnohj on Monday January 07, 2019 @09:16PM (#18852501)
You already know the type if you're calling .begin() or .end() on it. You don't care about the type of the iterator because you know it can iterate over the collection you're working with.

That's what auto fixes. It avoids coupling the concept of iterating from the specific type of the iterator which isn't important.

Similarly auto helps you achieve DRY. 'auto myFoo = std::make_unique<Foo>();'. The type wasn't removed, it just wasn't repeated twice.

But at this point auto, or things like auto, exist in nearly every major language. So you'll need to teach best practices for working with it at some point. That's a general thing that's everywhere.