return value in std::copy documentation seems to be wrong

Jonathan Wakely jwakely.gcc@gmail.com
Sun Oct 11 13:55:18 GMT 2020


On Sun, 11 Oct 2020 at 14:00, Johannes Choo <jhanschoo@gmail.com> wrote:
>
> Thanks! Also note that an analogous mistake is present in std::copy_backward

And std::move and std::move_backward.


>
> On Sun, Oct 11, 2020 at 8:37 PM Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>>
>> On Sun, 11 Oct 2020 at 08:18, Johannes Choo via Libstdc++
>> <libstdc++@gcc.gnu.org> wrote:
>> >
>> > Hi all,
>> >
>> > I'm a beginner with C++, but the documentation for std::copy seems to be
>> > mistaken in its documented return value (
>> > https://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01486.html#ga894f503412130680dc19c87af289f4f4
>> > ). It reads,
>> >
>> > Returns: result + (first - last)
>> >
>> > where the copy function signature is std::copy(first, last, result).
>> >
>> > Shouldn't it be
>> >
>> > result + (last - first) ?
>>
>> Yes, well spotted! I'll fix it, thanks.
>
>
>
> --
> Bests,
> Johannes
>
> Email: jhanschoo@gmail.com
> Skype: jhanschoo
> Mobile: +6584817735


More information about the Libstdc++ mailing list