If you use &quot;.end()&quot; on an C++ standard array collection, what you get is not the array size. You get an invalid iterator pointing one element past the end of the array, which tells you when to stop.<p>Most newer languages have built-in syntax for &quot;iterate over collection&quot;.  C++ does not, leading to somewhat clunky constructs like this.  It&#x27;s ugly, but that&#x27;s where C++ ended up.<p>(I personally think that the C++ committee went way too far in making the template fanatics happy.  It&#x27;s neat that C++ templates, being a general term-rewriting system, allow arbitrary computation at compile time, but templates are a terrible programming language.  More recently, it worries me that Rust is going too far in that direction.)