🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #2495

Re: Q: What does find_first_of() do?

#2495
From: Dick Menninger
Date: Fri, 10 Nov 1995 19:40
50 lines
2435 bytes
If you compare it with find_end which precedes it,
this appears to be a typo and should read:

> ==========Marian Hellema, 11/6/95==========
> 
> 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,
                                                BinaryPredicate pred);
                                                (^you left this off^)

> 
>     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),
                                                 *(i+n)  ==  
*(first2+=n)
                                                  ^^^^^
>     pred(*i,*(first2+n))  == true.  Returns last1 if no such
iterator is
  pred(*(i+n),*(first2+n))  == true
        ^^^^^
>     found.
> 

In your case, it should return v1+10 since {3,6,2} is not a
subsequence of v1.

Good Day
Dick
Dick.Menninger@DaytonOH.ATTGIS.COM
---
[ 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: <DHuECp.K3u@falcon.daytonoh.attgis.com>
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
References: <47kjd8$eq8@info.uci.kun.nl>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
Date: 10 Nov 95 19:40:01 GMT
Approved: fjh@cs.mu.oz.au
Newsgroups: comp.std.c++
From: Dick Menninger <Dick.Menninger@daytonoh.attgis.com>
Subject: Re: Q: What does find_first_of() do?
Message-ID: <DHuECp.K3u@falcon.daytonoh.attgis.com>
Reply-To: mennid <Dick.Menninger@daytonoh.attgis.com>
Organization: AT&T Global Information Solutions
X-Newsreader: DiscussIT 2.5.1.3 for MS Windows [AT&T Software Products Division]
References: <47kjd8$eq8@info.uci.kun.nl>
X-Original-Date: Fri, 10 Nov 1995 19:34:01 GMT
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMKOqnOEDnX0m9pzZAQGiOwF/aIsi/bVb1rJxmiHYf4DmjCJ8iGEfHvpU
 eNquOic3K3qtc+fGcRd3WtGVsU8ZVRWY
 =9w0b