Closed Morwenn closed 4 years ago
From what I have been told LWG3031 is worded so that algorithms are compliant no matter whether they accept predicates that take non-const
parameters or not. When predicates are valid with both const
or non-const
parameters it's up to the predicate author to make sure that they are consistent (calling such a predicate with const
or non-const
parameters has to return the same result).
I think that we could try to officially support predicates taking non-const
parameters too as long as they're consistent as described above. It would still be allowed by LWG3031 and stronger guarantee than the one provided by the standard.
Whatever the resolution we need to document it along with the other library guarantees in the main wiki page.
Thanks tcanens on Cpplang Slack and cry on C++ Help Discord to help me to understand that fine art of wordsmith.
Those two commits should be enough for most sorters and adapters to support predicates taking non-const references, as allowed by LWG3031. More support can be added later if needed.
The issue LWG3031 deals with predicates taking non-
const
references in sorting algorithms (and probably other classes of algorithms as well). It does sound like it matters to us too, so look at what they do and apply the required transformation to be consistent with the issue's resolution.