On 07/12/2023 14:41, Jonathan Wakely wrote:
On Wed, 6 Dec 2023 at 20:55, François Dumont <frs.dum...@gmail.com> wrote:
I think I still got no feedback about this cleanup proposal.
Can you remind me why we have all those different functions in
predefined_ops.h in the first place? I think it was to avoid having
two versions of every algorithm, one that does *l < *r and one that
does pred(*l, *r), right?
Yes, that was the purpose.
One property of the current code is that _Iter_less_iter will compare
exactly *lhs < *rhs and so works even with this type, where its
operator< only accepts non-const arguments:
struct X { bool operator<(X&); };
Doesn't your simplification break that, because the _Less function
only accepts const references now?
Indeed, I thought more about the problem of const qualification on the
operator(). This is why _Comp_val is mimicking what _Not_fn does.
To be honnest I even thought that this kind of operator above was more a
user code issue than a real use case we need to handle. But it looks
like you, I guess the C++ Standard then, impose to support it.
I'll rework it then, thanks for the proposal below and in your other email.