mir: How to change iterator?

jmh530 john.michael.hall at gmail.com
Mon Apr 20 10:30:55 UTC 2020


On Monday, 20 April 2020 at 00:27:40 UTC, 9il wrote:
> [snip]
>
> Using two arguments Iterator1, Iterator2 works without 
> allocation
>
> /+dub.sdl: dependency "mir-algorithm" version="~>3.7.28" +/
> import mir.ndslice;
>
> void foo(Iterator1, Iterator2, SliceKind kind)
>  	(Slice!(Iterator1, 1, kind) x, Slice!(Iterator2, 1, kind) y)
> {
>     import std.stdio : writeln;
>     writeln("here");
> }
>
> void main() {
>     auto x = [0.5, 0.5].sliced(2);
>     auto y = x * 5.0;
>     foo(x, y);
> }

Thanks, but I was thinking about the situation where someone else 
has written the function and didn't allow for multiple iterators 
for whatever reason.


More information about the Digitalmars-d-learn mailing list