20#ifndef RIPPLE_BASICS_PARTITIONED_UNORDERED_MAP_H
21#define RIPPLE_BASICS_PARTITIONED_UNORDERED_MAP_H
23#include <xrpl/beast/hash/uhash.h>
24#include <xrpl/beast/utility/instrumentation.h>
35template <
typename Key>
46 return ::beast::uhash<>{}(key);
73 unordered_map<key_type, mapped_type, hasher, key_equal, allocator_type>;
80 typename partition_map_type::iterator
ait_;
81 typename map_type::iterator
mit_;
141 return !(lhs == rhs);
150 typename partition_map_type::iterator
ait_;
151 typename map_type::iterator
mit_;
218 return !(lhs == rhs);
233 it.ait_ = it.map_->end();
234 it.mit_ = it.map_->back().end();
241 for (it.ait_ = it.map_->begin(); it.ait_ != it.map_->end(); ++it.ait_)
243 if (it.ait_->begin() == it.ait_->end())
245 it.mit_ = it.ait_->begin();
263 "ripple::partitioned_unordered_map::partitioned_unordered_map : "
264 "nonzero partitions");
329 it.mit_ = it.ait_->find(key);
330 if (it.mit_ == it.ait_->end())
351 template <
class T,
class U>
355 auto const& key = std::get<0>(keyTuple);
358 auto [eit, inserted] = it.
ait_->emplace(
359 std::piecewise_construct,
360 std::forward<T>(keyTuple),
361 std::forward<U>(valueTuple));
363 return {it, inserted};
366 template <
class T,
class U>
372 auto [eit, inserted] =
373 it.
ait_->emplace(std::forward<T>(key), std::forward<U>(val));
375 return {it, inserted};
value_type const & const_reference
const_iterator begin() const
value_type const * const_pointer
iterator erase(const_iterator position)
std::pair< iterator, bool > emplace(std::piecewise_construct_t const &, T &&keyTuple, U &&valueTuple)
std::pair< iterator, bool > emplace(T &&key, U &&val)
const_iterator cbegin() const
Value & operator[](Key const &key)
const_iterator cend() const
const_iterator end() const
iterator find(key_type const &key)
std::vector< map_type > partition_map_type
const_iterator find(key_type const &key) const
partition_map_type & map()
void find(key_type const &key, T &it) const
std::size_t partitions() const
partitioned_unordered_map(std::optional< std::size_t > partitions=std::nullopt)
std::size_t partitioner(Key const &key) const
T hardware_concurrency(T... args)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::size_t extract(uint256 const &key)
const_pointer operator->() const
friend bool operator!=(const_iterator const &lhs, const_iterator const &rhs)
const_iterator(partition_map_type *map)
friend bool operator==(const_iterator const &lhs, const_iterator const &rhs)
const_iterator(iterator const &orig)
const_reference operator*() const
const_iterator operator++(int)
const_iterator & operator++()
partition_map_type * map_
partition_map_type::iterator ait_
friend bool operator!=(iterator const &lhs, iterator const &rhs)
partition_map_type::iterator ait_
reference operator*() const
partition_map_type * map_
iterator(partition_map_type *map)
friend bool operator==(iterator const &lhs, iterator const &rhs)
pointer operator->() const