This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD status.
Section: 23.5.11 [alg.equal] Status: NAD Submitter: Gennaro Prota Opened: 2017-05-26 Last modified: 2017-07-12
Priority: Not Prioritized
View all issues with NAD status.
The description of the std::equal() algorithm in the standard doesn't make clear what the result of it is on empty ranges:
std::equal(first, first, second) ; // what does this return?
It should IMHO return true (two empty ranges are always equal).
[2017-07 Toronto Monday issue prioritization]
Closing as NAD; the existing wording covers empty sequences
This wording is relative to N4659.
Edit 23.5.11 [alg.equal] as indicated:
[Drafting note: The current wording presented below uses two times the unusual phrase "[…] return […]" instead of "[…] returns […]". The project editor is kindly asked to consider to replace these unusual wording forms by the usual one. — end drafting note]
template<class InputIterator1, class InputIterator2> bool equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2); […]
-1- Remarks: If last2 was not given in the argument list, it denotes first2 + (last1 - first1) below.-2- Returns: If last1 - first1 != last2 - first2, return false. Otherwise return true if for every iterator i in the range [first1, last1) the following corresponding conditions hold: *i == *(first2 + (i - first1)), pred(*i, *(first2 + (i - first1))) != false. Otherwise, returns false. […]