[algorithm] documentation mistakes in 'equal' and 'mismatch'
Hi, Marshall IIUC, I found some mistakes in the documentation of 'equal' and 'mismatch'. http://www.boost.org/doc/libs/1_54_0/libs/algorithm/doc/html/algorithm/CXX14... http://www.boost.org/doc/libs/1_54_0/libs/algorithm/doc/html/the_boost_algor... In the first code block, auto seq1 = { 0, 1, 2 }; auto seq2 = { 0, 1, 2, 3, 4 }; 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 The second seq1.begin() in the last line should be seq2.begin() as follows. std::equal ( seq1.begin (), seq1.end (), seq2.begin (), seq2.end ()); // false Similarly, std::mismatch ( seq1.begin (), seq1.end (), seq1.begin (), seq2.end ()); // <3, 3> should be std::mismatch ( seq1.begin (), seq1.end (), seq2.begin (), seq2.end ()); // <3, 3> Thanks, Takatoshi
On Oct 6, 2013, at 4:29 AM, Takatoshi Kondo
Hi, Marshall
IIUC, I found some mistakes in the documentation of 'equal' and 'mismatch'.
http://www.boost.org/doc/libs/1_54_0/libs/algorithm/doc/html/algorithm/CXX14... http://www.boost.org/doc/libs/1_54_0/libs/algorithm/doc/html/the_boost_algor...
In the first code block,
auto seq1 = { 0, 1, 2 }; auto seq2 = { 0, 1, 2, 3, 4 };
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
The second seq1.begin() in the last line should be seq2.begin() as follows.
std::equal ( seq1.begin (), seq1.end (), seq2.begin (), seq2.end ()); // false
Similarly,
std::mismatch ( seq1.begin (), seq1.end (), seq1.begin (), seq2.end ()); // <3, 3>
should be
std::mismatch ( seq1.begin (), seq1.end (), seq2.begin (), seq2.end ()); // <3, 3>
I just fixed these yesterday ;-) Thanks. -- Marshall Marshall Clow Idio Software mailto:mclow.lists@gmail.com A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait). -- Yu Suzuki
participants (2)
-
Marshall Clow
-
Takatoshi Kondo