front doesn't compile for arrays of immutable data

Timon Gehr timon.gehr at gmx.ch
Mon Jun 25 08:38:08 PDT 2012


On 06/25/2012 04:27 PM, 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?

It should always be possible to do so. What you are experiencing seems 
to be a compiler bug.


More information about the Digitalmars-d-learn mailing list