-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
LWG issue neededA wording defect that should be submitted to LWG as a new issueA wording defect that should be submitted to LWG as a new issueresolvedSuccessfully resolved without a commitSuccessfully resolved without a commit
Description
Hi,
It was found that search_n returns first when count<=0.
However, the C++ standard says (N4659 draft, the last draft before C++17):
Returns: The first iterator i in the range [first, last-count) such that for every non-negative integer n less than count the following corresponding conditions hold: (i + n) == value, pred((i+ n),value) != false. Returns last if no such iterator is found.
It seems that if n>=0 and count <=0 we don't have a chance to apply a predicate. So, we won't find "such iterator". According to this logic last should be returned. Am I right?
I'm just curious why does search_n implementation return first?
Metadata
Metadata
Assignees
Labels
LWG issue neededA wording defect that should be submitted to LWG as a new issueA wording defect that should be submitted to LWG as a new issueresolvedSuccessfully resolved without a commitSuccessfully resolved without a commit