Merge pull request #2522 from sinkuu/fix_tee

std.range.tee should accept function symbols
This commit is contained in:
H. S. Teoh 2014-09-19 12:04:38 -07:00
commit db0fa5e7d5

View file

@ -10105,12 +10105,17 @@ if (is(typeof(fun) == void) || isSomeFunction!fun)
it with the type of $(D inputRange.front).
*/
static if (is(typeof(fun) == void))
alias _fun = fun!(typeof(inputRange.front));
else
alias _fun = fun;
static if (isFunctionPointer!_fun || isDelegate!_fun)
{
return tee!pipeOnPop(inputRange, fun!(typeof(inputRange.front)));
return tee!pipeOnPop(inputRange, _fun);
}
else
{
return tee!pipeOnPop(inputRange, fun);
return tee!pipeOnPop(inputRange, &_fun);
}
}
@ -10265,3 +10270,12 @@ unittest
assert(equal(txt, appResult) && equal(appResult, appSink.data));
}
}
unittest
{
// Issue 13483
static void func1(T)(T x) {}
void func2(int x) {}
auto r = [1, 2, 3, 4].tee!func1.tee!func2;
}