Skip to content

Refactor std.range.chain to reduce symbol size bloat. #5611

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
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