Why can't templates use tuples for for argument types?

James Dennett jdennett at acm.org
Tue Jul 17 23:16:38 PDT 2007


Don Clugston wrote:
> BCS wrote:
>> |template Types(A...)
>> |{
>> |  template Values(A a)
>> |  {
>> |  }
>> |}
>> |
>> |alias Types!(int, bool, int[]).Values!(1,true,[1,2,3]) bob;
> 
> int [] is not an allowed as a template value parameter. Only char[],
> wchar[], dchar[], integers, and floating-point types can be template
> value parameters.
> (In C++, only integers are allowed).

Not true of C++.  Pointers to objects with external linkage
are also allowed (even if we assume "integers" includes
booleans and values of enumeration types).

(Allowing floating point types used to be a common extension
in C++ but was removed after experience with it.)

-- James


More information about the Digitalmars-d-learn mailing list