Deduct and return class type

tsbockman thomas.bockman at gmail.com
Sat Jan 23 06:08:27 UTC 2021


On Saturday, 23 January 2021 at 05:54:09 UTC, Виталий Фадеев 
wrote:
>     auto  listFactory( T )( T data )
>     {
>         return new List!( T )( data );
>     }

This is the correct way to do it in D; it's annoying, I know. 
(Personally, I usually shorten `listFactory` to just `list` to 
make the name as similar as possible to the type name, without 
actually causing a collision.)


More information about the Digitalmars-d-learn mailing list