License:
see license.txt

  • NO_LENGTH_SUPPORT
  • Returned from length() when length isn't supported

  • interface Iterator (V);
  • Basic iterator. Allows iterating over all the elements of an object.

  • uint length ();
  • If supported, returns the number of elements that will be iterated.

    If not supported, returns NO_LENGTH_SUPPORT.

  • int opApply (int delegate(ref V v) dg);
  • foreach operator.

  • interface KeyedIterator (K,V): Iterator!(V);
  • Iterator with keys. This allows one to view the key of the element as well as the value while iterating.

  • int opApply (int delegate(ref K k, ref V v) dg);
  • iterate over both keys and values

  • interface Purgeable (V);
  • A purge iterator is used to purge values from a collection. This works by telling the iterator that you want it to remove the value last iterated.

  • int purge (int delegate(ref bool doPurge, ref V v) dg);
  • iterate over the values of the iterator, telling it which values to remove. To remove a value, set doPurge to true before exiting the loop.

    Make sure you specify ref for the doPurge parameter:

     foreach(ref doPurge, v; &purgeable.purge){
     ...
    


  • interface KeyPurgeable (K,V): Purgeable!(V);
  • A purge iterator for keyed containers.

  • int keypurge (int delegate(ref bool doPurge, ref K k, ref V v) dg);
  • iterate over the key/value pairs of the iterator, telling it which ones to remove.

    Make sure you specify ref for the doPurge parameter:

     foreach(ref doPurge, k, v; &purgeable.keypurge){
     ...
    


    TODO:
    note this should have the name purge, but because of asonine lookup rules, it makes it difficult to specify this version over the base version. Once this is fixed, it's highly likely that this goes back to the name purge.

    See bugzilla #2498

    (C) 2008 by Steven Schveighoffer. All rights reserved :: page rendered by CandyDoc