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>
36template <
typename Key>
47 return ::beast::uhash<>{}(key);
74 unordered_map<key_type, mapped_type, hasher, key_equal, allocator_type>;
81 typename partition_map_type::iterator
ait_;
82 typename map_type::iterator
mit_;
142 return !(lhs == rhs);
151 typename partition_map_type::iterator
ait_;
152 typename map_type::iterator
mit_;
219 return !(lhs == rhs);
234 it.ait_ = it.map_->end();
235 it.mit_ = it.map_->back().end();
242 for (it.ait_ = it.map_->begin(); it.ait_ != it.map_->end(); ++it.ait_)
244 if (it.ait_->begin() == it.ait_->end())
246 it.mit_ = it.ait_->begin();
264 "ripple::partitioned_unordered_map::partitioned_unordered_map : "
265 "nonzero partitions");
330 it.mit_ = it.ait_->find(key);
331 if (it.mit_ == it.ait_->end())
352 template <
class T,
class U>
356 auto const& key = std::get<0>(keyTuple);
359 auto [eit, inserted] = it.
ait_->emplace(
361 std::forward<T>(keyTuple),
362 std::forward<U>(valueTuple));
364 return {it, inserted};
367 template <
class T,
class U>
373 auto [eit, inserted] =
374 it.
ait_->emplace(std::forward<T>(key), std::forward<U>(val));
376 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