Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can do that. That's part of C++11 and is supported by basically every major compiler.

The advantage of iterators is that they're incredibly flexible. You can use them for sub-ranges, reversed ranges, non-ranges like input and output iterators, etc, etc. This is vastly more powerful than something like, say, Objective C's NSFastEnumeration, which just allows for the trivial case handled by the range-based for-loop.



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

Search: