== Auszug aus bearophile (bearophileh...@lycos.com)'s Artikel
> Nrgyzer:
> > Is there any chance to cast/convert this array to an indexed
array or
> > is it possible to iterate over specific indices? I know that
there is
> > something like next() for the foreach-statement but when the array
> > contains some thousand instances and I only want iterate over (for
> > example) 5 elements I think that's the wrong way.
> Show a hypothetical code example of what you desire to do, please.
> Bye,
> bearophile

Example:

...
class Example(T : Drawable) : Drawable {

        T[hash_t] pObjectsToDraw;

        uint pFrom, pTo;

        void setLimit(from, to) {
                pFrom = from;
                pTo = to;
        }

        void remove(T objToRemove) {
                pObjectsToDraw.remove(objToRemove.toHash());
        }

        override void draw() {
                for (uint i = pFrom; i < pTo; i++) {
                        pOjectsToDraw[i].draw(); // cannot call
because pObjectsToDraw is an associative and no static or dynamic
array
                }
        }

}

Reply via email to