20 #ifndef RIPPLE_BASICS_PARTITIONED_UNORDERED_MAP_H
21 #define RIPPLE_BASICS_PARTITIONED_UNORDERED_MAP_H
33 template <
typename Key>
61 unordered_map<key_type, mapped_type, hasher, key_equal, allocator_type>;
68 typename partition_map_type::iterator
ait_;
69 typename map_type::iterator
mit_;
129 return !(lhs == rhs);
138 typename partition_map_type::iterator
ait_;
139 typename map_type::iterator
mit_;
206 return !(lhs == rhs);
221 it.ait_ = it.map_->end();
222 it.mit_ = it.map_->back().end();
229 for (it.ait_ = it.map_->begin(); it.ait_ != it.map_->end(); ++it.ait_)
231 if (it.ait_->begin() == it.ait_->end())
233 it.mit_ = it.ait_->begin();
314 it.mit_ = it.ait_->find(key);
315 if (it.mit_ == it.ait_->end())
336 template <
class T,
class U>
340 auto const& key = std::get<0>(keyTuple);
343 auto [eit, inserted] = it.ait_->emplace(
344 std::piecewise_construct,
345 std::forward<T>(keyTuple),
346 std::forward<U>(valueTuple));
348 return {it, inserted};
351 template <
class T,
class U>
357 auto [eit, inserted] =
358 it.ait_->emplace(std::forward<T>(key), std::forward<U>(val));
360 return {it, inserted};
374 it.ait_ = position.ait_;
375 it.mit_ = position.ait_->erase(position.mit_);
377 while (it.mit_ == it.ait_->end())
380 if (it.ait_ == it.map_->end())
382 it.mit_ = it.ait_->begin();
409 #endif // RIPPLE_BASICS_PARTITIONED_UNORDERED_MAP_H
partitioned_unordered_map(std::optional< std::size_t > partitions=std::nullopt)
iterator find(key_type const &key)
const_pointer operator->() const
partition_map_type & map()
const_iterator cend() const
Value & operator[](Key const &key)
std::size_t partitioner(Key const &key) const
partition_map_type * map_
void find(key_type const &key, T &it) const
std::size_t partitions() const
friend bool operator!=(iterator const &lhs, iterator const &rhs)
iterator(partition_map_type *map)
const_iterator & operator++()
const_iterator operator++(int)
pointer operator->() const
const_iterator begin() const
std::size_t partitioner(Key const &key, std::size_t const numPartitions)
T hardware_concurrency(T... args)
partition_map_type::iterator ait_
friend bool operator!=(const_iterator const &lhs, const_iterator const &rhs)
Seed functor once per construction.
partition_map_type * map_
value_type const & const_reference
friend bool operator==(iterator const &lhs, iterator const &rhs)
std::pair< iterator, bool > emplace(std::piecewise_construct_t const &, T &&keyTuple, U &&valueTuple)
iterator erase(const_iterator position)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
const_iterator end() const
const_iterator find(key_type const &key) const
const_iterator cbegin() const
partition_map_type::iterator ait_
reference operator*() const
const_iterator(iterator const &orig)
const_reference operator*() const
value_type const * const_pointer
friend bool operator==(const_iterator const &lhs, const_iterator const &rhs)
std::pair< iterator, bool > emplace(T &&key, U &&val)
const_iterator(partition_map_type *map)
std::vector< map_type > partition_map_type