News for hackers. Stuff that matters.
Re:The C++14 Standard: What You Need to Know by millstone on Thursday September 18, 2014 @01:04AM (#8333799)
Functions that return iterators are never called getSomeIterator(). Instead they're called stuff like erase(), insert(), or even nonsense words like crend().

And whether a function returns an iterator is not consistent even within the STL:

    auto loc = container.find("name");
What type is loc? If container is a std::map, then loc is an iterator. If container is a std::string, then loc is a size_t.

If you had used the explicit iterator type, you would at least get an error message immediately with the above line, instead of hoping your code does something that size_t doesn't support.

There are no comments on this comment yet.