Passing parameter when creating object array

Deewiant deewiant.doesnotlike.spam at gmail.com
Tue Aug 7 07:59:01 PDT 2007


Kirk McDonald wrote:
> Using new on a dynamic array type already allows you to pass something
> looking like a constructor call:
> 
> auto a = new int[](50); // An array of 50 elements
> 
> It might be appropriate to add a second, optional parameter to this
> constructor, with the array's default initializer:
> 
> auto b = new int[](50, 5); // An array of 50 5s
>

This syntax is already taken, for allocating nested arrays:
http://www.digitalmars.com/d/expression.html#NewExpression

-- 
Remove ".doesnotlike.spam" from the mail address.


More information about the Digitalmars-d-learn mailing list