6 #ifndef IROHA_COLLECTION_SET_HPP 7 #define IROHA_COLLECTION_SET_HPP 9 #include <shared_mutex> 10 #include <unordered_set> 23 template <
typename Key,
24 typename Hash = std::hash<Key>,
25 typename KeyEqual = std::equal_to<Key>>
37 template <
typename Collection>
39 std::lock_guard<std::shared_timed_mutex> lock(mutex_);
40 set_.insert(collection.begin(), collection.end());
48 template <
typename Collection>
50 std::lock_guard<std::shared_timed_mutex> lock(mutex_);
51 for (
auto &&val : collection) {
61 template <
typename Callable>
63 std::shared_lock<std::shared_timed_mutex> lock(mutex_);
64 std::for_each(set_.begin(), set_.end(), callable);
68 std::unordered_set<Key, Hash, KeyEqual> set_;
69 mutable std::shared_timed_mutex mutex_;
74 #endif // IROHA_COLLECTION_SET_HPP void insertValues(Collection &&collection)
Definition: collection_set.hpp:38
Key value_type
Definition: collection_set.hpp:30
Definition: collection_set.hpp:26
Definition: block_query.hpp:15
void removeValues(Collection &&collection)
Definition: collection_set.hpp:49
void forEach(Callable &&callable) const
Definition: collection_set.hpp:62