Template Trick

Ali Çehreli acehreli at yahoo.com
Wed Jun 12 14:47:06 PDT 2013


On 06/12/2013 02:26 PM, matovitch wrote:> Hello,
 >
 > I got a simple vector template :
 >
 > struct Vector(T, uint N)
 > {
 >        alias type T;

You later corrected that it should be

   alias T type;

But still, prefer the new syntax over the backward C syntax:

   alias type = T;

 >        T data[N];
 > }
 >
 > And I'd like to call a function like :
 >
 > void func(V, V.type default_value)(args...);

So, that function is already defined and you are trying to call it? How 
are you calling it? What is the error message?

 > But this (of course) doesn't work. Is there a simple and nice way
 > to do this ? (I'm sure there is ;-))

It is not clear to me what the purpose is. :)

Ali



More information about the Digitalmars-d-learn mailing list