Unordered map

Unordered map

unordered_map is the proposed C++ TR1 name for a hash table, accessible as std::tr1::unordered_map. unordered_map works very similarly to the existing map class in the C++ STL. It will replace the various incompatible implementations of the hash table (called hash_map by GCC and MSVC).

Until TR1 is officially accepted into the upcoming C++0x standard, unordered_map is available from the header file, and from in MSVC [ [http://msdn.microsoft.com/en-us/library/bb983026.aspx ] ] .

As its name implies, unlike the map class, the elements of an unordered_map are not ordered. This is due to the use of hashing to store objects. unordered_map can still be iterated through like a regular map.

It is closely related to unordered_multimap (available in the same header file), which is an implementation of multimap using hashing. It is also similar to unordered_set and unordered_multiset, implementations of the set and multiset containers respectively and available in the or headers.

unordered_map takes at least two and at most five template parameters, called Key, Data, Hash (or Hasher), Compare and Alloc. unordered_map will associate elements of type Key to elements of type Data; keys are unique in the map (for duplicate keys, unordered_multimap is used). Hash is a hash function which takes elements of type Key and produces an integer. Compare is a function which compares two keys for equality: this is needed for custom data types to resolve hash collisions, which occur when two elements hash to the same value but are actually different. Finally, Alloc is a function which allocates new elements.

References


Wikimedia Foundation. 2010.

Игры ⚽ Поможем сделать НИР

Look at other dictionaries:

  • Hash table — Not to be confused with Hash list or Hash tree. Unordered map redirects here. For the proposed C++ class, see unordered map (C++). Hash Table Type unsorted dictionary Invented 1953 Time complexity in big O notation Average Worst case Space …   Wikipedia

  • Comparison of programming languages (mapping) — Programming language comparisons General comparison Basic syntax Basic instructions Arrays Associative arrays String operations …   Wikipedia

  • C++ Technical Report 1 — (TR1) is the common name for ISO/IEC TR 19768, C++ Library Extensions, which is a document proposing additions to the C++ standard library. The additions include regular expressions, smart pointers, hash tables, and random number generators. TR1… …   Wikipedia

  • combinatorics — /keuhm buy neuh tawr iks, tor , kom beuh /, n. (used with singular v.) See combinatorial analysis. * * * Branch of mathematics concerned with the selection, arrangement, and combination of objects chosen from a finite set. The number of possible… …   Universalium

  • Set theory (music) — Example of Z relation on two pitch sets analyzable as or derivable from Z17 (Schuijer 2008, p.99), with intervals between pitch classes labeled for ease of comparison between the two sets and their common interval vector, 212320. Musical set… …   Wikipedia

  • Nerve guidance conduit — A nerve guidance conduit (also referred to as an artificial nerve conduit or artificial nerve graft, as opposed to an autograft) is an artificial means of guiding axonal regrowth to facilitate nerve regeneration and is one of several clinical… …   Wikipedia

  • Orbifold — This terminology should not be blamed on me. It was obtained by a democratic process in my course of 1976 77. An orbifold is something with many folds; unfortunately, the word “manifold” already has a different definition. I tried “foldamani”,… …   Wikipedia

  • C++0x — is the planned new standard for the C++ programming language. It is intended to replace the existing C++ standard, ISO/IEC 14882, which was published in 1998 and updated in 2003. These predecessors are informally known as C++98 and C++03. The new …   Wikipedia

  • HTML element — This article is about the HTML elements in general. For information on how to format Wikipedia entries, see Help:Wiki markup and Help:HTML in wikitext HTML HTML and HTML5 Dynamic HTML XHTML XHTML Mobile Profile and C HTML Canvas element Character …   Wikipedia

  • Cyclic order — In mathematics, a cyclic order is a way to arrange a set of objects in a circle.[nb] Unlike most structures in order theory, a cyclic order cannot be modeled as a binary relation a < b . One does not say that east is more clockwise than west.… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”