Boost logo

Boost :

Subject: Re: [boost] [algorithm] documentation mistakes in 'equal' and 'mismatch'
From: Marshall Clow (mclow.lists_at_[hidden])
Date: 2013-10-06 14:31:29


On Oct 6, 2013, at 4:29 AM, Takatoshi Kondo <redboltz_at_[hidden]> wrote:

> 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.html#the_boost_algorithm_library.CXX14.equal
> http://www.boost.org/doc/libs/1_54_0/libs/algorithm/doc/html/the_boost_algorithm_library/CXX14/mismatch.html
>
> 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_at_[hidden]>

A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
        -- Yu Suzuki


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk