Content deleted Content added
cleanup, history section |
|||
Line 1:
{{C++ Standard library}}
'''<code>unordered_map</code>''' is a class template representing a [[hash table]] in the [[C++ Technical Report 1]] (TR1)<ref>{{Citation |title=A Proposal to Add Hash Tables to the Standard Library (revision 4) |author=WG21 |date=9 April 2003 |url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1456.html |id=n1456}}</ref> and the [[C++11]] standard<ref name="n3126">{{citation|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3126.pdf |title=Working Draft, Standard for Programming Language C++ |author=WG21 |date=2010-08-21 |id=n3126}}</ref>. It is similar to the <code>[[hash map (C++ class)|hash_map]]</code> class template of the original [[Standard Template Library|STL]]<ref>{{cite web |url= http://www.sgi.com/tech/stl/hash_map.html |title=hash_map<Key, Data, HashFcn, EqualKey, Alloc> |publisher=[[Silicon Graphics|SGI]] |accessdate=26 January 2011}}</ref> which was also included in several implementations of the C++ Standard Library (e.g. in the [[GNU Compiler Collection|GCC's]] [[libstdc++]]<ref>{{cite web |url=http://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-4.1/class____gnu__cxx_1_1hash__map.html |title=libstdc++: hash_map Class Template Reference |accessdate=26 January 2011}}</ref> or with [[Visual C++|MSVC]]).▼
In computing, '''unordered associative containers''' refer to a group of class templates in the [[C++ Standard Library|standard library]] of the [[C++|C++ programming language]] that implement variations of [[hash table]]. Being [[Template (programming)|templates]], they can be used to store arbitrary elements, such as integers or custom classes. The following containers are defined in the current revision of the C++ standard: <code>unordered_set</code>, <code>unordered_map</code>, <code>unordered_multiset</code>, <code>unordered_multimap</code>. Each of these containers differ only on constraints placed on their elements.
It is similar to the <code>[[map (C++ container)|map]]</code> class in the [[C++ Standard Library|C++ standard library]] but has different constraints. As its name implies, unlike the <code>map</code> class, the elements of an <code>unordered_map</code> are not [[well ordering|ordered]]. This is due to the use of hashing to store objects. <code>unordered_map</code> can still be [[iterator|iterated]] through like a regular map.▼
▲
==History==
▲
The <code>hash_*</code> class templates were proposed into [[C++ Technical Report 1|C++ TR1]] and were accepted under names <code>unordered_*</code>.<ref>{{cite web |title=A Proposal to Add Hash Tables to the Standard Library (revision 4) |author=WG21 |date=9 April 2003 |url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1456.html |id=n1456}}</ref> Later, they were incorporated into the [[C++11]] revision of the C++ standard.<ref name="n3126">{{citation|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3126.pdf |title=Working Draft, Standard for Programming Language C++ |author=WG21 |date=2010-08-21 |id=n3126}}</ref>. An implementation is also available in the [[Boost C++ Libraries]] as <code><boost/unordered_map.hpp></code><ref>{{cite web |publisher=Boost |title=Class template unordered_map |url=http://www.boost.org/doc/libs/1_45_0/doc/html/boost/unordered_map.html |accessdate=26 January 2011}}</ref>.
==Design==
{{expand section|date=October 2011}}
===Overview of functions===
**<code>unordered_map::[http://en.cppreference.com/w/cpp/container/unordered_map/unordered_map unordered_map]</code> (constructor) - Constructs the unordered map from variety of sources.
|