[Issue 8333] New: std.Container.Array (and .Range) du not implement opIndexUnary

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 1 10:25:07 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8333

           Summary: std.Container.Array (and .Range) du not implement
                    opIndexUnary
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: monarchdodra at gmail.com


--- Comment #0 from monarchdodra at gmail.com 2012-07-01 10:27:44 PDT ---
This code does not compile:

----
import std.container;

void main()
{
  Array!int myList;
  myList.length = 2;

  auto range = myList[];
  ++myList[0];
  ++range[0];
}
----

Suggest adding:

phobos / std / container.d l.1775
----
        void opIndexUnary(string op)(size_t i)
        {
            enforce(_a + i < _b && _b <= _outer._data._payload.length);
            mixin(op~"_outer._data._payload.ptr[_a + i];");
        }
----


phobos / std / container.d l.1950
----
/// ditto
    void opIndexUnary(string op)(size_t i)
    {
        mixin(op~"_data._payload[i];");
    }
----

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list