mirror of
https://github.com/dlang/phobos.git
synced 2025-04-27 13:40:20 +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...)
|
||||
{
|
||||
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 ~ "]" ~
|
||||
".Types[" ~ toCtString!(tags[i]) ~ "])(), " ~ argsFrom!(i + 1);
|
||||
enum handlerArgs = argsFrom!0;
|
||||
|
||||
alias handlerArgs = AliasSeq!();
|
||||
|
||||
static foreach (i; 0 .. tags.length)
|
||||
{
|
||||
handlerArgs = AliasSeq!(
|
||||
handlerArgs,
|
||||
"args[" ~ toCtString!i ~ "].get!(SumTypes[" ~ toCtString!i ~ "]" ~
|
||||
".Types[" ~ toCtString!(tags[i]) ~ "])(), "
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Matching
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue