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

Mehrdad wfunction at hotmail.com
Sun Jun 10 19:47:36 PDT 2012


On Monday, 11 June 2012 at 02:25:54 UTC, Jonathan M Davis wrote:
> Now, since in this particular case, what find returns won't 
> ever include anything from any arguments other than the first, 
> it'll be fine.


Yes, that's precisely why your statement didn't make sense to me. 
:)



> But for any templated function which returns a portion of its 
> argument, having it take a static array for that argument would 
> be horribly broken. For instance,
>
> auto found = find([1, 2, 3, 4, 5], 3);
>
> _would_ definitely return a slice which referred to garbage 
> were array literals
static and find accepted them.


Ah, that's a different example. :)


Hm... could you automatically convert the static arrays to 
dynamic if the argument isn't 'scope'?


More information about the Digitalmars-d mailing list