std.container & ranges

Max Wolter awishformore at gmail.com
Sun Oct 30 03:38:30 PDT 2011


Hello there.

I seem to be having problems wrapping my head around how to use the 
ranges in the context of containers in phobos. Specifically, I can't 
seem to figure out how to remove an element from a linked list.

          foreach(cell; organism)
          {
             if(cell.x == x && cell.y == y)
             {
                organism.stableLinearRemove(cell);
                break;
             }
          }

mind.d(123): Error: function 
std.container.SList!(Cell).SList.linearRemove (Range r) is not callable 
using argument types (Cell)
mind.d(123): Error: cannot implicitly convert expression (cell) of type 
cell.Cell to Take!(Range)

I somehow get the feeling such a basic operation should just...work?

/Max


More information about the Digitalmars-d-learn mailing list