ambs (22) [Avatar] Offline
#1
Page 6, end of second paragraph

The only task of the count_lines function is to convert its input (the file name) to the type that the std::count can understand (a pair of stream iterators).


My C++ is limited, but I think the first argument to std::count is the iterator, and the second the type of the iterator elements.
Ivan Cukic (97) [Avatar] Offline
#2
I don't understand what you meant.

The signature of count is:

count( InputIt first, InputIt last, const T &value );


The first two arguments are iterators, and the last one is the value we are counting.
ambs (22) [Avatar] Offline
#3
I think it was that problem with the markup in the code that confused me.

This is the exact code:
return std::count(
        std::istream_iterator<char>(in),
        std::istream_iterator<char>(),
        '\n');


So, yes, two iterators and the char to count. Sorry.