diff --git a/doc/equal.qbk b/doc/equal.qbk index 859a8a1..0ba221c 100644 --- a/doc/equal.qbk +++ b/doc/equal.qbk @@ -22,7 +22,7 @@ Consider the two sequences: std::equal ( seq1.begin (), seq1.end (), seq2.begin ()); // true std::equal ( seq2.begin (), seq2.end (), seq1.begin ()); // Undefined behavior - std::equal ( seq1.begin (), seq1.end (), seq1.begin (), seq2.end ()); // false + std::equal ( seq1.begin (), seq1.end (), seq2.begin (), seq2.end ()); // false ``` You can argue that `true` is the correct answer in the first case, even though the sequences are not the same. The first N entries in `seq2` are the same as the entries in `seq1` - but that's not all that's in `seq2`. But in the second case, the algorithm will read past the end of `seq1`, resulting in undefined behavior (large earthquake, incorrect results, pregnant cat, etc). diff --git a/doc/mismatch.qbk b/doc/mismatch.qbk index 630bdc1..cf74293 100644 --- a/doc/mismatch.qbk +++ b/doc/mismatch.qbk @@ -22,7 +22,7 @@ Consider the two sequences: std::mismatch ( seq1.begin (), seq1.end (), seq2.begin ()); // <3, 3> std::mismatch ( seq2.begin (), seq2.end (), seq1.begin ()); // Undefined behavior - std::mismatch ( seq1.begin (), seq1.end (), seq1.begin (), seq2.end ()); // <3, 3> + std::mismatch ( seq1.begin (), seq1.end (), seq2.begin (), seq2.end ()); // <3, 3> ``` The first N entries in `seq2` are the same as the entries in `seq1` - but that's not all that's in `seq2`. In the second case, the algorithm will read past the end of `seq1`, resulting in undefined behavior (large earthquake, incorrect results, pregnant cat, etc). diff --git a/doc/one_of.qbk b/doc/one_of.qbk index 4170407..e5d873b 100644 --- a/doc/one_of.qbk +++ b/doc/one_of.qbk @@ -75,7 +75,7 @@ All of the variants of `one_of` and `one_of_equal` take their parameters by valu * `one_of` and `one_of_equal` both return false for empty ranges, no matter what is passed to test against. -* The second parameter to `one_of_value` is a template parameter, rather than deduced from the first parameter (`std::iterator_traits::value_type`) because that allows more flexibility for callers, and takes advantage of built-in comparisons for the type that is pointed to by the iterator. The function is defined to return true if, for one element in the sequence, the expression `*iter == val` evaluates to true (where `iter` is an iterator to each element in the sequence) +* The second parameter to `one_of_equal` is a template parameter, rather than deduced from the first parameter (`std::iterator_traits::value_type`) because that allows more flexibility for callers, and takes advantage of built-in comparisons for the type that is pointed to by the iterator. The function is defined to return true if, for one element in the sequence, the expression `*iter == val` evaluates to true (where `iter` is an iterator to each element in the sequence) [endsect]