Questions about the slice operator
Simen Kjærås
simen.kjaras at gmail.com
Wed Apr 4 05:37:54 PDT 2012
On Wed, 04 Apr 2012 14:21:01 +0200, Jacob Carlborg <doob at me.com> wrote:
> On 2012-04-04 14:16, Simen Kjærås wrote:
>
>> And what do we do with 3..$?
>
> Hmm, that's a good point. The best I can think of for now is to
> translate that to:
>
> range(3, size_t.max)
>
> Or something like:
>
> struct range
> {
> size_t start;
> size_t end;
> bool dollar; // better name is needed
> }
>
> range(3, 0, true)
>
Not enough:
$-3..$-2
This is a hard and unpleasant one, unless we go with $ being
defined as the length of the array we're slicing, and only valid
inside a slice operation. (and of course some opDollar or the
like for other containers)
More information about the Digitalmars-d-learn
mailing list