Hacker News new | past | comments | ask | show | jobs | submit login

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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: