Getting ready

In this recipe, we will use as an example, the dummy_array class and its iterators that we implemented in the previous recipe, Writing your own random access iterator. You should read that recipe before continuing with this one.

Non-member begin()/end() functions and the other variants, as well as non-member data(), size() and empty() are available in the std namespace in the <iterator> header, which is implicitly included with any of the following headers: <array>, <deque>, <forward_list>, <list>, <map>, <regex>, <set>, <string>, <unordered_map>, <unordered_set>, and <vector>.

In this recipe, we will refer to the std::begin()/std::end() functions, but everything discussed also applies to the other functions: std::cbegin()/std::cend(), std::rbegin()/std::rend(), and std::crbegin()/std::crend().

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset