License:
see license.txt

  • struct Hash (V,alias hashFunction,alias updateFunction,float loadFactor = HashDefaults.loadFactor,uint startingTableSize = HashDefaults.tableSize,alias Allocator = DefaultAllocator,bool allowDuplicates = false,bool doUpdate = true);
  • Default Hash implementation. This is used in the Hash * containers by default.

    The implementation consists of a table of linked lists. The table index that an element goes in is based on the hash code.

  • alias Node ;
  • alias for Node

  • alias allocator ;
  • alias for the allocator

  • allocator alloc ;
  • The allocator for the hash

  • Node[] table ;
  • the table of buckets

  • uint count ;
  • count of elements in the table

  • struct position ;
  • This is like a pointer, used to point to a given element in the hash.

  • position next ();
  • Returns the position that comes after p.

  • position prev ();
  • Returns the position that comes before p.

  • bool add (V v);
  • Add a value to the hash. Returns true if the value was not present, false if it was updated.

  • void resize (uint capacity);
  • Resize the hash table to the given capacity. Normally only called privately.

  • void checkLoadFactor ();
  • Check to see whether the load factor dictates a resize is in order.

  • position begin ();
  • Returns a position that points to the first element in the hash.

  • position end ();
  • Returns a position that points past the last element of the hash.

  • position find (V v);
  • Find the first instance of a value

  • position remove (position pos);
  • Remove a given position from the hash.

  • void clear ();
  • Remove all values from the hash

  • uint intersect (Iterator!(V) subset);
  • keep only elements that appear in subset

    returns the number of elements removed

  • void copyTo (ref Hash target);
  • copy all the elements from this hash to target.

  • void setup ();
  • Perform any setup necessary (none for this hash impl)

  • template HashNoUpdate (V,alias hashFunction,float loadFactor = HashDefaults.loadFactor,uint startingTableSize = HashDefaults.tableSize,alias Allocator = DefaultAllocator)
  • used to define a Hash that does not perform updates

  • template HashDup (V,alias hashFunction,float loadFactor = HashDefaults.loadFactor,uint startingTableSize = HashDefaults.tableSize,alias Allocator = DefaultAllocator)
  • used to define a Hash that takes duplicates

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