cplusplus / nbballot

Handling of NB comments in response to ballots
14 stars 4 forks source link

GB310 25 [algorithms] Mark some new algorithms as [[nodiscard]] #306

Closed wg21bot closed 4 years ago

wg21bot commented 4 years ago

Some new algorithms should be marked [[nodiscard]] These algorithms are equality-preserving, and are ultimately read operations. They should be marked as [[nodiscard]] to reflect that their result is always intended to be used. Consider similar change for lexicographical_compare_three_way.

Proposed change: Add [[nodiscard]] to the following ranges:: algorithms. All algorithms in [alg.nonmodifying]. remove (not a read operation, but the result should rarely be discarded) remove_if (not a read operation, but the result should rarely be discarded) is_sorted is_sorted_until All algorithms in [alg.binarysearch]. is_parititoned partition_point includes is_heap All algorithms in [alg.min.max]. lexicographical_compare Possibly also add nodiscard to lexicographical_compare_three_way.

tituswinters commented 4 years ago

LEWG in Belfast: Rejected. No consensus for change.