import std.array; struct DataAndView { int[] data, view; this(int x) { data = [1, 2, 3, 4, 5]; view = data[x .. $]; } } unittest { auto a = DataAndView(1); assert (sameTail(a.data, a.view)); enum b = DataAndView(1); assert (!sameTail(b.data, b.view)); }
In CTFE it seems. Only tested with DMD on Windows though. Is this a
known limitation, or a bug, I couldn't find anything that seemed to
match it in the bugzilla.
- When is a slice not a slice? Alix Pexton via Digitalmars-d-learn
- Re: When is a slice not ... Philippe Sigaud via Digitalmars-d-learn
- Re: When is a slice not ... Steven Schveighoffer via Digitalmars-d-learn
- Re: When is a slice ... Alix Pexton via Digitalmars-d-learn
- Re: When is a sl... Rene Zwanenburg via Digitalmars-d-learn
- Re: When is ... Steven Schveighoffer via Digitalmars-d-learn
- Re: Whe... Alix Pexton via Digitalmars-d-learn
- Re: Whe... Alix Pexton via Digitalmars-d-learn
- Re: When is a slice not ... Alix Pexton via Digitalmars-d-learn
- Re: When is a slice ... Alix Pexton via Digitalmars-d-learn
- Re: When is a slice not ... Jesse Phillips via Digitalmars-d-learn