template with more than one tuple parameter
Zhenya
zheny at list.ru
Sat Jul 28 10:08:55 PDT 2012
On Saturday, 28 July 2012 at 16:47:48 UTC, Simen Kjaeraas wrote:
> On Sat, 28 Jul 2012 18:17:14 +0200, Zhenya <zheny at list.ru>
> wrote:
>
>> Why do not D allow templates with more than one tuple
>> parameters,at the
>> same time that C++11 support it:
>
> Well, Walter implemented type tuples with automatic flattening,
> back when dinosaurs roamed the earth (we now help people who
> have
> questions). We've lived with that decision since then, and
> though
> there are times when a non-flattening system would have been
> nice,
> it's easy enough to work around:
>
> template NonFlatteningTuple( T... ) {
> alias T types;
> }
>
> template Foo( T, U ) {
> // Do things with T.types and U.types here
> }
>
> Foo!( NonFlatteningTuple!(int, float), NonFlatteningTuple!() );
But function template can deduce types without explicit
instansiation,regular template can't.
More information about the Digitalmars-d-learn
mailing list