Challenge

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 5 08:07:01 PDT 2016


On Thursday, October 06, 2016 00:38:54 Manu via Digitalmars-d wrote:
> I thought there was a distinction between typetuple and alias? Some
> expression can be captured by a typetuple, but not by alias?
> There must be a reason for that horrible and prolific pattern "(T...)
> if(T.length == 1) { ... T[0] ... }" instead of "(alias T) { ... T ...
> }"?

That has to do with the fact alias template parameters don't take keywords,
even if they're types. alias declarations don't have that problem. If they
did, we couldn't have stuff like size_t or c_long. In theory, Walter has
agreed that we'll fix it so that template alias parameters are consistent
with alias declarations, but that hasn't happened yet. And until it does,
we're stuck with the weird variadic templates of length 1.

- Jonathan M Davis



More information about the Digitalmars-d mailing list