Article View: comp.std.c++
Article #2141Size argument to count/count_if
From: 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. ]
Technical Details
Message-ID:
<452tp0$m65@shellx.best.com>Path:
arc1-ca.pugleaf.net!128.32.155.1!mattShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!128.32.155.1!matt From: law@solution-frameworks.com Newsgroups: comp.std.c++ Subject: Size argument to count/count_if Date: 06 Oct 1995 21:36:01 GMT Organization: Solution Frameworks, San Jose CA Approved: matt@physics2.Berkeley.EDU (Matt Austern) Message-ID: <452tp0$m65@shellx.best.com> Reply-To: law@solution-frameworks.com (Bill Law) NNTP-Posting-Host: physics2.berkeley.edu