static array literal syntax request: auto x=[1,2,3]S;

Jonathan M Davis jmdavisProg at gmx.com
Sun Jun 10 17:16:37 PDT 2012


On Monday, June 11, 2012 02:08:53 Mehrdad wrote:
> >> Type deduction.
> > 
> > Exactly. And if they need to be assigned to a static array,
> > then the compiler
> > can automatically do what it needs to do to avoid the extra
> > heap allocation.
> > 
> > - Jonathan M Davis
> 
> "Type deduction"?  o.O
> I don't understand... could someone give me an example of what
> would break if we used the rule I suggested?

Pretty much anything involving templates would break. For instance,

auto found = find(arr, [1, 2]);

wouldn't compile, because [1, 2] would be considered a static array, which 
isn't a range.

- Jonathan M Davis


More information about the Digitalmars-d mailing list