[Issue 13214] array.opSlice one element falsy empty

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Jul 27 05:39:42 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13214

Jonathan M Davis <jmdavisProg at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg at gmx.com

--- Comment #2 from Jonathan M Davis <jmdavisProg at gmx.com> ---
??? Of course a[1 .. 1] is empty. It's just like a[0 .. 0] or a[$ .. $]. If you
want one element starting at index 1, then you need to do a[1 .. 2].

So, if the problem is that you think that a[1 .. 1] is supposed to be a range
of length 1, starting at index 1, then you misunderstand how slice indices
work.

(In reply to Robert Schadek from comment #1)
> empty is wrong:
> 
> it should be _a > _b but that crashed a bunch of other programs

And this comment makes no sense to me. There is no _a or _b in this example, so
I don't know what you're trying to say.

--


More information about the Digitalmars-d-bugs mailing list