Thread View: comp.std.c++
1 messages
1 total messages
Started by law
Fri, 06 Oct 1995 21:36
Size argument to count/count_if
Author: law
Date: Fri, 06 Oct 1995 21:36
Date: Fri, 06 Oct 1995 21:36
31 lines
1320 bytes
1320 bytes
I have a question about the nature of the final argument to
the count and count_if algorithms. Must this argument
support post-increment, operator +=, operator + and assigment,
or something else?
More precisely, the public-domain HP implementation of count()
is:
template < class InputIterator, class T, class Size >
void count( InputIterator first, InputIterator last,
const T &value, Size &n ) {
while ( first != last )
if ( *first++ == value ) n++;
}
Why couldn't the interesting expression be any of:
n += 1
n -= -1
n = n + 1
etc?
The WP doesn't seem to provide sufficient guidance (or else
I couldn't find it).
Bill Law
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads