On 2013-11-11 10:02, bearophile wrote:

Can't you do the same thing with functions similar (same API but
different semantics) to std.algorithm ones that generate expression
templates?

auto person = persons.filter!(e => e.name == "John");

I have been thinking about that, a solution where "e" is a proxy that implements opDispatch and which returns a new proxy which overloads "==". The problem with this is that you cannot separately overload the equal and comparison operators. In D the all the comparisons operators are implement with the single overload, opCmp. You cannot know from inside of opCmp if it's the "<" or the ">" operator that is being called. Same problem with opEquals.

--
/Jacob Carlborg

Reply via email to