Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions std/range/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -886,18 +886,22 @@ Returns:

See_Also: $(LREF only) to chain values to a range
*/
auto chain(Ranges...)(Ranges rs)
template chain(Ranges...)
if (Ranges.length > 0 &&
allSatisfy!(isInputRange, staticMap!(Unqual, Ranges)) &&
!is(CommonType!(staticMap!(ElementType, staticMap!(Unqual, Ranges))) == void))
{
static if (Ranges.length == 1)
auto chain(Ranges rs)
{
return rs[0];
static if (Ranges.length == 1)
return rs[0];
else
return Result(rs);
}
else

static if (Ranges.length > 1)
{
static struct Result
struct Result
{
private:
alias R = staticMap!(Unqual, Ranges);
Expand Down Expand Up @@ -1197,7 +1201,6 @@ if (Ranges.length > 0 &&
return result;
}
}
return Result(rs);
}
}

Expand Down