front doesn't compile for arrays of immutable data

Roman D. Boiko rb at d-coding.com
Mon Jun 25 08:46:24 PDT 2012


On Monday, 25 June 2012 at 15:39:07 UTC, Jonathan M Davis wrote:
> On Monday, June 25, 2012 16:27:20 Roman D. Boiko wrote:
>> @property ref T front(T)(T[] a)
>> if (!isNarrowString!(T[]) && !is(T[] == void[]))
>> {
>>      assert(a.length, "Attempting to fetch the front of an 
>> empty
>> array of " ~
>>             typeof(a[0]).stringof);
>>      return a[0];
>> }
>> 
>> Why is front returned by ref even when it is not possible to do
>> so?
>
> What do you mean that it's not possible? What's not possible 
> about it?
>
> - Jonathan M Davis

Looks like I came to wrong conclusions, so my statement from 
second post should be ignored. The first post shows the problem.


More information about the Digitalmars-d-learn mailing list