
on Sun Oct 30 2011, "Peter Dimov" <pdimov-AT-pdimov.com> wrote:
Dave Abrahams wrote:
Actually it needs a bit more than that: applying ! to your bool-ish thing needs to be unambiguously &&-able with the result of i != j, which might not itself be bool.
That's part of what bool-ish means. For two bool-ish values x and y, x&&y should be bool-ish and
(x&&y?true:false) == (x?true:false)&&(y?true:false)
I think you're missing the point, which is: When the specification for an algorithm exposes the actual expressions used in a given implementation of an algorithm, it tends to lock down the implementation in ways that don't necessarily make sense (and can prevent optimizations). Tiny details that one usually doesn't consider, like whether part of the expression is an lvalue or an rvalue, const or non-const, become encoded into the specification of the algorithm. -- Dave Abrahams BoostPro Computing http://www.boostpro.com