This seems to be a problem in the way the template constraint for chain finds the element types for all of the ranges. It thinks that the element type for Take!(Repeat!string) is string, so it comes up with CommonType!(string, dchar) which is void.
-----------------------
import std.range;
void main()
{
string a = "abc";
string b = "xyz";
chain(repeat(a, 2), b);
}
test.d(8): Error: template std.range.chain cannot deduce function from argument types !()(Take!(Repeat!string), string)
Comment #1 by ag0aep6g — 2015-10-22T19:33:47Z
(In reply to Jack Stouffer from comment #0)
> It thinks that the element
> type for Take!(Repeat!string) is string, so it comes up with
> CommonType!(string, dchar) which is void.
But the ElementType really is string. `repeat` "repeats one value". So if you pass a string, the elements of the range are that one string again and again. Then you try to chain a range of dchars (a string) to that range of strings, which fails as expected.
You have to either join the range of strings from `repeat` into a range of dchars (std.algorithm.joiner), or turn the single string you want to chain on into a range (std.range.only).