On Thursday, 14 February 2013 at 19:57:25 UTC, Jacob Carlborg
wrote:
On 2013-02-14 15:28, Steven Schveighoffer wrote:
Would this work?
bool any(R)(R r) if(isInputRange!R) { return !r.empty;}
Yes, I already have something similar. Actually I have this:
@property bool any (T) (T value) if (__traits(compiles, { bool
a = value.empty; }))
{
return !value.empty;
}
The only purpose of this is to make code more readable, correct?
(The few extra keystrokes to write !a.empty seem negligable).
It fails at that, because "any" means something different to a
lot of people, creating confusion as opposed to clarity.