Suggestion: shortcut for 'new X'

Oskar Linde oskar.lindeREM at OVEgmail.com
Thu Aug 24 08:10:12 PDT 2006


Kristian wrote:
> How about this:
> 
>     Obj obj1 = new Obj;
>     Obj obj2 = new Obj(10);
> 
> could be reduced to:
> 
>     Obj obj1 = new;
>     Obj obj2 = new(10);
> 
> This way only one class name would be required per variable. (That is, 
> one at maximum: "Obj obj1 = new, obj2 = new(10);" is also valid of 
> course.) Redundance would be reduced.

You can already do:

auto obj1 = new Obj;
auto obj2 = new Obj(10);

which takes care of the redundant Obj.



More information about the Digitalmars-d mailing list