5#ifndef BITCOIN_RWCOLLECTION_H
6#define BITCOIN_RWCOLLECTION_H
10#include <boost/range/iterator.hpp>
13#include <shared_mutex>
23 using type =
decltype(std::declval<T &>()[std::declval<I>()]);
40 using iterator =
typename boost::range_iterator<T>::type;
43 std::reverse_iterator<iterator>
rbegin() {
51 std::reverse_iterator<const_iterator>
rbegin()
const {
54 std::reverse_iterator<const_iterator>
rend()
const {
RWCollectionView< const T, std::shared_lock< std::shared_mutex > > ReadView
ReadView getReadView() const
RWCollectionView< T, std::unique_lock< std::shared_mutex > > WriteView
std::shared_mutex rwmutex
const T * operator->() const
std::reverse_iterator< const_iterator > rend() const
std::reverse_iterator< iterator > rend()
std::reverse_iterator< const_iterator > rbegin() const
BracketType< I >::type operator[](I &&index)
Forward bracket operator.
const_iterator begin() const
std::reverse_iterator< iterator > rbegin()
RWCollectionView(L l, T &c)
typename boost::range_iterator< T >::type iterator
Iterator mechanics.
const RWCollectionView & operator=(const RWCollectionView)=delete
const_iterator end() const
RWCollectionView(const RWCollectionView &)=delete
RWCollectionView(RWCollectionView &&other)
typename boost::range_iterator< const T >::type const_iterator
Implement std::hash so RCUPtr can be used as a key for maps or sets.
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
decltype(std::declval< T & >()[std::declval< I >()]) type