Is hash_map part of the STL?

C++StlHashmap

C++ Problem Overview


Quick question...Is hash_map part of the STL?

C++ Solutions


Solution 1 - C++

The STL has hash_map, but the C++ Standard Library does not.

Due to a common misconception, you may think of the C++ Standard Library as "the STL", or of parts of your toolchain's implementation of the C++ Standard Library as "an STL implementation".

It is not.

It is also a great shame that both MSVC++ and GCC (which implement hash_map as a compiler-specific extension), place it in the std namespace, which is not only highly misleading, but also illegal per the standard. *sigh*

C++11 has introduced std::unordered_map, which is not dissimilar.

Solution 2 - C++

Quoting Wikipedia (emphasis added):

From the STL page: >The Standard Template Library (STL) is a software library partially included in the C++ Standard Library.

...and then from the hash_map page

> In the C++ programming language, > hash_map is the name of a hashed > associative container in the Standard > Template Library. It is provided by > several implementors, such as the GNU > C++ compiler and Microsoft's Visual > C++. It is not part of the C++ > Standard Library, but the C++ > Technical Report 1 contains the very > similar container unordered_map, which > will be included in the upcoming C++0x > standard.

So in short,

  • YES it's part of the STL.
  • But it IS NOT part of the standard library.
  • But it is supported by several very popular implementations.

Solution 3 - C++

The problem is that there is no agreed upon meaning for the term STL. Is hash_map part of Standard C++? No, it isn't. unordered_map will be part of the new C++ standard, however, and is a map implemented using hashing.

Solution 4 - C++

Yes, hash_map is part of the STL. However, it is not part of C++03's standard library.

Solution 5 - C++

hash_map is a part of STL, but not a part of Standard C++(C++11). And there is a similar implementation of hash_map named "std::unordered_map" in standard C++: http://www.cplusplus.com/reference/unordered_map/unordered_map/

Currently, GNU C++ and MSVC++ have implemented hash_map for compiler extension, as well as Boost. Meanwhile, SGI has its own implementation for hash_map. You can refer to http://www.sgi.com/tech/stl/hash_map.html for details.

Solution 6 - C++

No...Hash_map is not part of the STL standard.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJakeView Question on Stackoverflow
Solution 1 - C++Lightness Races in OrbitView Answer on Stackoverflow
Solution 2 - C++razlebeView Answer on Stackoverflow
Solution 3 - C++user2100815View Answer on Stackoverflow
Solution 4 - C++Alexandre C.View Answer on Stackoverflow
Solution 5 - C++holybinerView Answer on Stackoverflow
Solution 6 - C++RaghuramView Answer on Stackoverflow