×

Loading...

a c++ test for c++ friends

Implement the following generic Standard Library function defined in <algo>:
template <class Src1, class Src2>
Src1 search (Scr1 i, Src1 j, Src2 p, Src2 q);
// Searches the sequence i…(j-1) for a subsequence that equals
// the sequence p…(q-1). If found, position k where it begins
// is returned; otherwise, j is returned.
// Invariant: no elements are changed.

I cannot understand the meaning. How can I find a Src2 sequence in a Src1 sequence? How to access to next Src1 from (Src1 i) to (Src1 j).
Who could give the Implement? Thanks in advance!
Report

Replies, comments and Discussions: