find_if. McGraw-Hill The Complete Reference Fourth Edition
โฆษณา
โฆษณา
844
C + + : T h e C o m p l e t e R e f e r e n c e
ForIter2 start2, ForIter2 end2); template <class ForIter1, class ForIter2, class BinPred>
ForIter1 find_first_of(ForIter1 start1, ForIter1 end1,
ForIter2 start2, ForIter2 end2,
BinPred pfn);
The find_first_of( ) algorithm finds the first element within the sequence defined by start1 and end1 that matches an element within the range start1 and end1. If no matching element is found, the iterator end1 is returned.
The second form allows you to specify a binary predicate that determines when elements match.
find_if
template <class InIter, class UnPred>
InIter find_if(InIter start, InIter end, UnPred pfn);
The find_if( ) algorithm searches the range start to end for an element for which the unary predicate pfn returns true. It returns an iterator to the first occurrence of the element or to end if the value is not in the sequence.
for_each
template<class InIter, class Func>
Func for_each(InIter start, InIter end, Func fn);
The for_each( ) algorithm applies the function fn to the range of elements specified by start and end. It returns fn.
generate and generate_n
template <class ForIter, class Generator> void generate(ForIter start, ForIter end, Generator fngen); template <class ForIter, class Size, class Generator> void generate_n(OutIter start, Size num, Generator fngen);
The algorithms generate( ) and generate_n( ) assign to elements in a range the values returned by a generator function. For generate( ), the range being assigned is
ดาวน์โหลด
โฆษณา