Talk:cpp/iterator/end
From cppreference.com
< Talk:cpp
[edit] Other non-member ends()
The header <initializer_list> defines one more versions of non-member begin and one more end (FDIS 18.9.3) and the header <valarray> two more begins and two more ends (FDIS 26.6.10) They would neatly fit into this page and the cpp/iterator/begin page, except they are defined in different headers and logically are parts of initializer_list and valarray public interfaces and belong to their individual class pages. How should that be dealt with? --Cubbi 19:29, 22 August 2011 (PDT)
- I think we can solve this problem in the same way as for
std::swap
, see cpp/algorithm/swap and e.g. cpp/container/vector/swap.P12 19:44, 22 August 2011 (PDT)
- The difference is that cpp/container/vector/swap is a member function, while std::end(std::initializer_list<E>) and std::end(std::valarray<T>&) with std::end(const std::valarray<T>&) are non-members. But if if you mean they belong to cpp/utility/initializer_list and valarray's page (which needs to be created), okay, makes sense, do the same as for operator overloads. --Cubbi 20:16, 22 August 2011 (PDT)
- OOps, wrong link. Should have been cpp/container/vector/std_swap.P12 05:59, 23 August 2011 (PDT)
[edit] past-the-end
It should be noted that end() returns the element after the last element. The actual last element is accessed with back()