Rust switches to external iteration
Timon Gehr
timon.gehr at gmx.ch
Thu Jul 4 05:04:42 PDT 2013
On 07/04/2013 11:49 AM, Peter Alexander wrote:
> On Thursday, 4 July 2013 at 08:18:22 UTC, Timon Gehr wrote:
>> It should be as simple as:
>>
>> auto map(alias a,R)(R r){
>> foreach(x;r)
>> yield a(x);
>> }
>
> ... if all you care about is input ranges ...
>
> I don't think there's any way to automatically infer and implement
> random access, bidirectionality etc. on ranges from an internal
> iteration definition.
There is no way that works in the general case, but it should be easy
enough to infer from eg. the above implementation.
More information about the Digitalmars-d
mailing list