Talk:cpp/algorithm
From cppreference.com
Simple question: Why is count() listed here and distance() listed in the iterators library?
- The most direct answer is probably that std::count is a part of the algorithms library in C++ (chapter 25 of the standard), while std::distance is part of the Iterators library (chapter 24 of the standard). They are also declared in different headers. Note that
std::count
does something with the elements of a sequence, whilestd::distance
operates on iterators only. --Cubbi (talk) 04:21, 19 September 2014 (PDT)