Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Page 590: The description of "search" from <algorithm> is inconsistent with the example and incorrectly worded. #126
In this text from the page:
There are two main problems here:
(1) Notice that the variables "ipt_begin1" and "ipt_begin2" are different from what's actually used in the function declaration given later, which instead uses "fwd_" variants of the names.
(2) Most importantly, the phrase "or ipt_begin2 if no subsequence is found" appears to be wrong and misleading. The test case code shows that it appears to actually return an end iterator (which is far more reasonable), not a begin iterator. This was very confusing when I first read it. I'm sure it will confuse others too.
In contrast though, returning a begin iterator for searching for an empty subseq makes sense, since an empty subsequence is a subsequence of any sequence, but that's a different case.
Consider a general rewrite of the paragraph in general too, perhaps.