stride in slices

DigitalDesigns DigitalDesigns at gmail.com
Sun Jun 3 11:13:52 UTC 2018


On Sunday, 3 June 2018 at 07:30:56 UTC, Meta wrote:
> On Saturday, 2 June 2018 at 18:49:51 UTC, DigitalDesigns wrote:
>> Proposal:
>>
>> [a..b;m]
>>
>> m is the stride, if ; is not a good char then |, :, !, or # 
>> could be good chars.
>
> This is exactly what std.range.stride does. The syntax [a..b;m] 
> directly translates to [a..b].stride(m).


So, can I do

X[a..b].stride(m) = 0;

? Just curious because if it is exactly the same notion then I 
should be able to do it, right?

Of course, I'm sure another hoop could be created to jump through 
and it will work, will it still be exactly the same though?

If there is an efficient and optimal setting so one could get the 
same effect, then I guess it might be a direct translation. If 
not then it isn't.

What I am looking for is a sort of zeromemory or memset with 
stride. It should not allocate a new array or be significantly 
slower. I'd like some proof that they are "equivalent" such as a 
disassembly or a profiling... just to satisfy my own skepticism.





More information about the Digitalmars-d mailing list