Ranges and/versus iterators

Fawzi Mohamed fawzi at gmx.ch
Wed Mar 24 15:05:57 PDT 2010


On 24-mar-10, at 15:11, Fawzi Mohamed wrote:

>
> On 24-mar-10, at 15:00, Fawzi Mohamed wrote:
>
>> [...]
>> give a try to
>> 	bool popFront(ref T) ( or next, or another name, or even just a  
>> delegate with that signature)
>> I was surprised how well it works, not perfect but better than the  
>> other alternatives I had tried.
>
> I forgot to say, that one of the main pita with that approach is  
> having to declare the arguments before using them, but should you  
> decide that it is indeed a good alternative I have no doubt that you  
> could find a good syntactic sugar that Walter could implement... :)

if one would have methods
	bool f(ref T)
as valid iterators
then syntactic sugar replacing
	expr(f(auto a));
with
	static if(is(f S==function)){
	 S args;
	 expr(f(args));
	} else {static assert(0);}
would be nice.




More information about the Digitalmars-d mailing list