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

import std.array;

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

Meta