How to convert this function into a template ?

Vinod K Chandran kcvinu82 at gmail.com
Tue Oct 2 14:39:15 UTC 2018


On Tuesday, 2 October 2018 at 12:23:47 UTC, Jonathan M Davis 
wrote:
>
> The template equivalent would have been something like
>
> void arrayAdd(T)(ref T[] x, T value)
> {
>     auto index = x.length;
>     x.length += 1;
>     x[index] = value;
> }
>
> But if you're new to the language, I'd suggest that you read 
> this site / book:
>
> http://ddili.org/ders/d.en/index.html
>
> - Jonathan M Davis
Thanks a lot. Great help !. I will sure the check the link. :)
The doumentation did not tell me about the (T) in template. I can 
understand the "(T)" s inside the parentheses but i can't 
understand the one after template name.




More information about the Digitalmars-d-learn mailing list