Article View: comp.std.c++
Article #2437Q: What does find_first_of() do?
From: Marian Hellema
Date: Mon, 06 Nov 1995 10:50
Date: Mon, 06 Nov 1995 10:50
37 lines
2136 bytes
2136 bytes
I am not sure what the algorithm find_first_of() does.
At first glance I thought it finds the first occurence of an element
of a sequence.
So if I have:
int v1[10] = { 0,1,2,3,3,5,3,7,8,8 };
int v2[3] = {3,6,2 };
int *p = find_first_of( v1, v1+10, v2, v2+3 );
it would return an iterator to the first 3.
But then I read section 25.1.4 in the april working paper:
find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
ForwardIterator2 first2, ForwardIterator2 last2);
Returns:
The first iterator i in the range [first1, last1-(last2-first2))
such that for any non-negative integer n < (last2-first2), the fol-
lowing corresponding conditions hold: *i == *(first2+=n),
pred(*i,*(first2+n)) == true. Returns last1 if no such iterator is
found.
I simply do not understand what this says; the more I read it, the more
I get confused. It seems to say that all the elements in the second range
[first2, last2) should have the same value??
Thanks to anyone who can explain,
Marian
--
----------------------------------------------------------------------
Marian Hellema AT Computing, UNIX training and consultancy
email: marian@atcmp.nl P.O. Box 1428, 6501 BK Nijmegen
phone: +31 24 3527225 the Netherlands
---
[ 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:
<47kjd8$eq8@info.uci.kun.nl>Path:
arc1-ca.pugleaf.net!in1.uu.net!bounce-backShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back Date: 06 Nov 95 10:50:38 GMT Approved: fjh@cs.mu.oz.au From: Marian Hellema <marian@atcmp.nl> Newsgroups: comp.std.c++ Subject: Q: What does find_first_of() do? X-Original-Date: 6 Nov 1995 09:10:00 GMT Organization: AT Computing, Nijmegen, the Netherlands Message-ID: <47kjd8$eq8@info.uci.kun.nl> X-Mailer: Mozilla 1.1N (X11; I; SunOS 5.4 sun4m) X-Url: news:comp.std.c++/6769-6783?ALL X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUBMJ3otOEDnX0m9pzZAQHoUgF7B5cR34tZJy052nRJnGgQl/ZRXXTtEB6u I5oxXjJ8pX/iWx326fGRzRxk3/k7xguP =SK+h