std.v2020.algorithm etc[ WAS: Is run.d going to be expand for runtime and the phobos library?]
Petar
Petar
Sat Jun 20 12:26:55 UTC 2020
On Saturday, 20 June 2020 at 12:05:18 UTC, jmh530 wrote:
> On Saturday, 20 June 2020 at 10:43:41 UTC, Paul Backus wrote:
>> [snip]
>>
>> Also, switch from `void popFront()` to `typeof(this) rest`, so
>> that we can have `const` and `immutable` ranges.
>
> Would typeof(this) work where popFront is currently a
> free-standing function, like with built-in dynamic arrays?
typeof(this) is only possible for member function based
implementations. Otherwise the implementation for arrays would be:
inout(T)[] rest(T)(input(T)[] array) { return array[1 .. $]; }
https://run.dlang.io/gist/run-dlang/7a4e5872ee26c083b916303fe36ac43b?compiler=dmd
More information about the Digitalmars-d
mailing list