diff --git a/notebooks/06_STL.ipynb b/notebooks/06_STL.ipynb index 644d31f6cc3d289880d75d72d619316bf8285d15..a1179e0f0166bb5bf66cb82130f60b3c5cf05313 100644 --- a/notebooks/06_STL.ipynb +++ b/notebooks/06_STL.ipynb @@ -1110,6 +1110,45 @@ "}" ] }, + { + "cell_type": "markdown", + "id": "da22b078", + "metadata": {}, + "source": [ + "#### 'Free Functions'\n", + "C++ introduced free-function forms of ```begin()``` and ```end()``` which we can use alternatively to the member functions above:" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "id": "ceb3de09", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "4\n", + "5\n", + "6\n" + ] + } + ], + "source": [ + "for( cIter it = begin( lc ), e = end( lc ); it != e; it++ ) {\n", + " std::cout << *it << std::endl;\n", + "}" + ] + }, + { + "cell_type": "markdown", + "id": "14632b71", + "metadata": {}, + "source": [ + "Why did we introduce ```e```? Is it necessary?" + ] + }, { "cell_type": "markdown", "id": "c731df99",