April 20, 2020 Re: mir: How to change iterator? | ||||
---|---|---|---|---|
| ||||
Posted in reply to 9il | 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.
|
Copyright © 1999-2021 by the D Language Foundation