Title
Empty range behavior unclear for several algorithms
Status
tc1
Section
[alg.min.max]
Submitter
Nico Josuttis

Created on 2000-02-26.00:00:00 last changed 164 months ago

Messages

Date: 2010-10-21.18:28:33

Rationale:

The LWG looked in some detail at all of the above mentioned algorithms, but believes that except for min_element() and max_element() it is already clear that last is returned if first == last.

Date: 2010-10-21.18:28:33

Proposed resolution:

In [alg.min.max] - Minimum and maximum, paragraphs 7 and 9, append: Returns last if first==last.

Date: 2000-02-26.00:00:00

The standard doesn't specify what min_element() and max_element() shall return if the range is empty (first equals last). The usual implementations return last. This problem seems also apply to partition(), stable_partition(), next_permutation(), and prev_permutation().

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg1873
2010-10-21 18:28:33adminsetmessages: + msg1872
2000-02-26 00:00:00admincreate