2022-06-09 10:20:06 +02:00
# Boost.Unordered
2025-09-19 09:07:03 +02:00
[](https://github.com/boostorg/unordered/tree/master) [](https://github.com/boostorg/unordered/actions/workflows/ci.yml) [](https://drone.cpp.al/boostorg/unordered) [](https://ci.appveyor.com/project/cppalliance/unordered/branch/master) [](https://codecov.io/gh/boostorg/unordered/branch/master) [](https://pdimov.github.io/boostdep-report/master/unordered.html) [](https://www.boost.org/doc/libs/master/libs/unordered/index.html) [](https://regression.boost.org/master/developer/unordered.html)< br />
[](https://github.com/boostorg/unordered/tree/develop) [](https://github.com/boostorg/unordered/actions/workflows/ci.yml) [](https://drone.cpp.al/boostorg/unordered) [](https://ci.appveyor.com/project/cppalliance/unordered/branch/develop) [](https://codecov.io/gh/boostorg/unordered/branch/develop) [](https://pdimov.github.io/boostdep-report/develop/unordered.html) [](https://www.boost.org/doc/libs/develop/libs/unordered/index.html) [](https://regression.boost.org/develop/developer/unordered.html)< br />
2023-10-31 09:38:53 +01:00
[](https://www.boost.org/users/license.html) < img alt = "C++11 required" src = "https://img.shields.io/badge/standard-C%2b%2b11-blue.svg" > < img alt = "Header-only library" src = "https://img.shields.io/badge/build-header--only-blue.svg" >
2022-06-09 10:20:06 +02:00
2023-10-29 18:46:51 +01:00
Boost.Unordered offers a catalog of hash containers with different standards compliance levels, performances and intented usage scenarios:
2022-06-09 10:20:06 +02:00
2023-10-29 18:46:51 +01:00
**`boost::unordered_set` `boost::unordered_map` `boost::unordered_multiset` `boost::unordered_multimap` **
2022-06-09 10:20:06 +02:00
2023-10-29 18:46:51 +01:00
< ul > Fully conformant implementations of < code > std::unordered_[multi ](set|map )</ code > ,
but faster and up to the latest revisions of the standard even if you're working in an older version of C++ (heterogeneous lookup,
< code > try_emplace< / code > , < code > contains< / code > , etc.)< / ul >
2022-06-09 10:20:06 +02:00
2023-10-29 18:46:51 +01:00
**`boost::unordered_flat_set` `boost::unordered_flat_map` **
2022-06-09 10:20:06 +02:00
2023-10-29 18:46:51 +01:00
< ul > The fastest of the lot. Based on open addressing, these containers slightly
deviate from the standard in exchange for top performance.< / ul >
2022-06-09 10:20:06 +02:00
2023-10-29 18:46:51 +01:00
**`boost::unordered_node_set` `boost::unordered_node_map` **
2022-06-09 10:20:06 +02:00
2023-10-29 18:46:51 +01:00
< ul > Variations of < code > boost::unordered_flat_(set|map)< / code > providing pointer stability.< / ul >
2022-06-09 10:20:06 +02:00
2023-10-29 18:46:51 +01:00
**`boost::concurrent_flat_set` `boost::concurrent_flat_map` **
2022-06-09 10:20:06 +02:00
2023-10-29 18:46:51 +01:00
< ul > High performance for multithreaded scenarios. Introducing a new non-standard, iterator-free API.< / ul >
2022-06-09 10:20:06 +02:00
2024-09-06 10:00:28 +02:00
**`boost::concurrent_node_set` `boost::concurrent_node_map` **
< ul > Variations of < code > boost::concurrent_flat_(set|map)< / code > providing pointer stability.< / ul >
2023-10-29 18:46:51 +01:00
## Learn about Boost.Unordered
2022-06-09 10:20:06 +02:00
2023-10-29 18:46:51 +01:00
* [Online documentation ](https://boost.org/libs/unordered )
* [Some benchmarks ](https://github.com/boostorg/boost_unordered_benchmarks )
* Technical articles on Boost.Unordered internal design:
* [Advancing the state of the art for `std::unordered_map` implementations ](https://bannalia.blogspot.com/2022/06/advancing-state-of-art-for.html )
* [Inside `boost::unordered_flat_map` ](https://bannalia.blogspot.com/2022/11/inside-boostunorderedflatmap.html )
* [Inside `boost::concurrent_flat_map` ](https://bannalia.blogspot.com/2023/07/inside-boostconcurrentflatmap.html )
* [Bulk visitation in `boost::concurrent_flat_map` ](https://bannalia.blogspot.com/2023/10/bulk-visitation-in-boostconcurrentflatm.html )
2024-09-06 10:00:28 +02:00
* Debugging visualizers for Boost.Unordered:
* [Natvis for boost::unordered_map, and how to use <Intrinsic> elements ](https://blog.ganets.ky/NatvisForUnordered/ )
* [Natvis for boost::concurrent_flat_map, and why fancy pointers are hard ](https://blog.ganets.ky/NatvisForUnordered2/ )
* [Visualizing boost::unordered_map in GDB, with pretty-printer customization points ](https://blog.ganets.ky/PrettyPrinter/ )
2022-06-09 10:20:06 +02:00
2023-10-29 18:46:51 +01:00
Boost.Unordered can be installed in a number of ways:
2022-06-09 10:20:06 +02:00
2023-10-29 18:46:51 +01:00
* [Download Boost ](https://www.boost.org/users/download/ ) and you're ready to go (this is a header-only library requiring no building).
2024-09-06 10:00:28 +02:00
* Using Conan 2: In case you don't have it yet, add an entry for Boost in your `conanfile.txt` (the example requires at least Boost 1.86):
2023-10-29 18:46:51 +01:00
```
[requires]
2024-09-06 10:00:28 +02:00
boost/[>=1.86.0]
2023-10-29 18:46:51 +01:00
```
< ul > If you're not using any compiled Boost library, the following will skip building altogether:< / ul >
2022-06-09 10:20:06 +02:00
2023-10-29 18:46:51 +01:00
```
[options]
boost:header_only=True
```
* Using vcpkg: Execute the command
```
vcpkg install boost-unordered
```
* Using CMake: [Boost CMake support infrastructure ](https://github.com/boostorg/cmake )
allows you to use CMake directly to download, build and consume all of Boost or
some specific libraries.
## Support
* Join the ** #boost -unordered** discussion group at [cpplang.slack.com ](https://cpplang.slack.com/ )
([ask for an invite ](https://cppalliance.org/slack/ ) if you’ re not a member of this workspace yet)
* Ask in the [Boost Users mailing list ](https://lists.boost.org/mailman/listinfo.cgi/boost-users )
(add the `[unordered]` tag at the beginning of the subject line)
* [File an issue ](https://github.com/boostorg/unordered/issues )
## Contribute
* [Pull requests ](https://github.com/boostorg/unordered/pulls ) against **develop** branch are most welcome.
Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0 ](http://www.boost.org/LICENSE_1_0.txt ).