mirror of
https://github.com/dlang/phobos.git
synced 2025-05-01 23:50:31 +03:00
sumtype: avoid template recursion in handlerArgs
This commit is contained in:
parent
7362ac5bee
commit
be59d94737
1 changed files with 11 additions and 4 deletions
|
@ -2102,10 +2102,17 @@ private size_t stride(size_t dim, lengths...)()
|
||||||
private template handlerArgs(size_t caseId, typeCounts...)
|
private template handlerArgs(size_t caseId, typeCounts...)
|
||||||
{
|
{
|
||||||
enum tags = TagTuple!typeCounts.fromCaseId(caseId);
|
enum tags = TagTuple!typeCounts.fromCaseId(caseId);
|
||||||
enum argsFrom(size_t i : tags.length) = "";
|
|
||||||
enum argsFrom(size_t i) = "args[" ~ toCtString!i ~ "].get!(SumTypes[" ~ toCtString!i ~ "]" ~
|
alias handlerArgs = AliasSeq!();
|
||||||
".Types[" ~ toCtString!(tags[i]) ~ "])(), " ~ argsFrom!(i + 1);
|
|
||||||
enum handlerArgs = argsFrom!0;
|
static foreach (i; 0 .. tags.length)
|
||||||
|
{
|
||||||
|
handlerArgs = AliasSeq!(
|
||||||
|
handlerArgs,
|
||||||
|
"args[" ~ toCtString!i ~ "].get!(SumTypes[" ~ toCtString!i ~ "]" ~
|
||||||
|
".Types[" ~ toCtString!(tags[i]) ~ "])(), "
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Matching
|
// Matching
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue