From 1bd1173a1082162c4f91458e7626f64d90adf942 Mon Sep 17 00:00:00 2001 From: Tessil Date: Sat, 12 Aug 2017 12:24:15 +0200 Subject: [PATCH] Add infos on thread-safety and exceptions guarantees. --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8124650..e39f374 100644 --- a/README.md +++ b/README.md @@ -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. @@ -36,8 +36,12 @@ for(auto it = map.begin(); it != map.end(); ++it) { - The map can only hold up to 232 - 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.