Templates for DRY code

codephantom me at noyb.com
Sat Jan 6 09:30:32 UTC 2018


On Saturday, 6 January 2018 at 03:08:19 UTC, Ali Çehreli wrote:
>
>
> I agree with your point as well.
> A better name can help there a little.
>

void ConvertAndAppend(T, S)(ref T[] arr, S s) {
     arr ~= s.to!T;
}


problem solved ;-)

btw. I never thought that I would be able (or actually..willing) 
to program using templates, still I found D.

Thanks to those responsible for making them so easy to use 
(presumably Walter and Andrei).



More information about the Digitalmars-d-learn mailing list