Namespaces
Variants
Views
Actions

Talk:cpp/algorithm/copy backward

From cppreference.com

The statement, that `d_last` must not be within [`first`, `last`), is not in line with the text in the standard. The standard instead requires that `d_last` is not within the range (`first`, `last`]. See C++11 (2011-09-01) section 25.3.1/13. The reason I haven't just fixed it, is that I realize that it may be a typo in the standard. Does anyone know if this is covered by errata? --Kristian (talk) 14:00, 6 September 2013 (PDT)

Thanks for noticing the error. The standard is correct -- d_last must not be equivalent to last. I've fixed the inconsistency. --P12 14:01, 6 September 2013 (PDT)
This is really a pre/post C++11 standard wording difference.
  • C++98 25.2.1[lib.alg.copy]/6 Requires: result shall not be in the range [first, last).
  • C++03 25.2.1[lib.alg.copy]/6 Requires: result shall not be in the range [first, last).
  • C++11 (n3337) 25.3.1[alg.copy]/13 Requires: result shall not be in the range (first,last].
  • C++14 (n3690) 25.3.1[alg.copy]/14 Requires: result shall not be in the range (first,last].

This was the defect #1206--Cubbi (talk) 14:08, 6 September 2013 (PDT)

Being a defect, I assume there is no reason to mention the pre C++11 wording in this page, right? --Kristian (talk) 14:46, 6 September 2013 (PDT)