mapFlat

fill output range with result of fn() called per elements

void
mapFlat
(
alias fn
R
V
E...
)
(
ref R output
,
V val
,
)
if (
is(typeof(output.put(fn((ElementTypeRec!V).init))))
)

Examples

1 import std.array;
2 
3 auto app = appender!(int[])();
4 mapFlat!(a=>to!int(a)*2)( app, [1,2], 3,
5                    [[4,5],[6]],
6                    iota(7,9),
7                    [[[9],[10,11]],[[12]]],
8                    Vec([13.3,666,105]) );
9 assertEq( app.data, [2,4,6,8,10,12,14,16,18,20,22,24,26,1332,210] );

Meta