Skip to content

Commit

Permalink
Add infos on thread-safety and exceptions guarantees.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tessil committed Aug 12, 2017
1 parent b82494f commit 1bd1173
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Build Status](https://travis-ci.org/Tessil/ordered-map.svg?branch=master)](https://travis-ci.org/Tessil/ordered-map) [![Build status](https://ci.appveyor.com/api/projects/status/7fug7piv59d0in36/branch/master?svg=true)](https://ci.appveyor.com/project/Tessil/ordered-map/branch/master)
## C++ hash map/set which preserves the order of insertion
## C++ hash map and hash set which preserves the order of insertion

The ordered-map library provides a hash map and a hash set which preserve the order of insertion in a way similar to Python's [OrderedDict](https://docs.python.org/3/library/collections.html#collections.OrderedDict). When iterating over the map, the values will be returned in the same order as they were inserted.

Expand Down Expand Up @@ -36,8 +36,12 @@ for(auto it = map.begin(); it != map.end(); ++it) {
- The map can only hold up to 2<sup>32</sup> - 1 values, that is 4 294 967 295 values.
- No support for some bucket related methods (like bucket_size, bucket, ...).
Thread-safety guarantee is the same as `std::unordered_map` (possible to have multiple readers). Concerning the strong exception guarantee, it holds only if `ValueContainer::emplace_back` has the strong exception guarantee (which is true for `std::vector` and `std::deque` as long as the type T is not a move-only type with a move constructor that may throw an exception, see [details](http://en.cppreference.com/w/cpp/container/vector/emplace_back#Exceptions)).
These differences also apply between `std::unordered_set` and `tsl::ordered_set`.
### Installation
To use ordered-map, just add the project to your include path. It is a **header-only** library.
Expand Down

0 comments on commit 1bd1173

Please sign in to comment.