13 #ifndef CXXUTILS_CONCURRENTSTRMAP_H 
   14 #define CXXUTILS_CONCURRENTSTRMAP_H 
   21 #include "boost/iterator/iterator_facade.hpp" 
   22 #include <type_traits> 
   73 template <
class VALUE, 
template <
class> 
class UPDATER>
 
   74 requires (detail::IsConcurrentHashmapPayload<VALUE> &&
 
   75           detail::IsUpdater<UPDATER>)
 
   76 class ConcurrentStrMap
 
   89   using key_type = std::string;
 
   90   using mapped_type = 
VALUE;
 
   91   using size_type = size_t;
 
   93   using Updater_t = 
typename Impl_t::Updater_t;
 
   95   using Context_t = 
typename Updater_t::Context_t;
 
   97   using Lock_t = 
typename Impl_t::Lock_t;
 
  100   static_assert( 
sizeof(
typename Impl_t::val_t) >= 
sizeof(mapped_type) );
 
  111   ConcurrentStrMap (Updater_t&& updater,
 
  112                     size_type capacity = 64,
 
  113                     const Context_t& ctx = Updater_t::defaultContext());
 
  125   ConcurrentStrMap (
const ConcurrentStrMap& 
other,
 
  127                     size_t capacity = 64,
 
  128                     const Context_t& ctx = Updater_t::defaultContext());
 
  143   template <
class InputIterator>
 
  144   ConcurrentStrMap (InputIterator 
f,
 
  147                     size_type capacity = 64,
 
  148                     const Context_t& ctx = Updater_t::defaultContext());
 
  152   ConcurrentStrMap (
const ConcurrentStrMap& 
other) = 
delete;
 
  153   ConcurrentStrMap (ConcurrentStrMap&& 
other) = 
delete;
 
  154   ConcurrentStrMap& 
operator= (
const ConcurrentStrMap& 
other) = 
delete;
 
  167   size_type 
size() 
const;
 
  179   size_t capacity() 
const;
 
  194   using const_iterator_value = std::pair<const key_type&, mapped_type>;
 
  207     : 
public boost::iterator_facade<const_iterator,
 
  208                                     const const_iterator_value,
 
  209                                     std::bidirectional_iterator_tag,
 
  210                                     const const_iterator_value>
 
  217     const_iterator (
typename Impl_t::const_iterator 
it);
 
  230     friend class boost::iterator_core_access;
 
  248     bool equal (
const const_iterator& 
other) 
const;
 
  254     const const_iterator_value dereference() 
const;
 
  258     typename Impl_t::const_iterator m_impl;
 
  269   const_iterator_range 
range() 
const;
 
  275   const_iterator 
begin() 
const;
 
  281   const_iterator 
end() 
const;
 
  287   const_iterator cbegin() 
const;
 
  293   const_iterator cend() 
const;
 
  309   size_type 
count (
const key_type& 
key) 
const;
 
  318   const_iterator 
find (
const key_type& 
key) 
const;
 
  328   mapped_type at (
const std::string& 
key) 
const;
 
  338   std::pair<const_iterator, const_iterator>
 
  339   equal_range (
const key_type& 
key) 
const;
 
  364   std::pair<const_iterator, bool>
 
  365   emplace (
const key_type& 
key, mapped_type 
val,
 
  366            const Context_t& ctx = Updater_t::defaultContext());
 
  381   std::pair<const_iterator, bool>
 
  382   emplace (
const Lock_t& 
lock,
 
  383            const key_type& 
key, mapped_type 
val,
 
  384            const Context_t& ctx = Updater_t::defaultContext());
 
  398   std::pair<const_iterator, bool>
 
  399   emplace (key_type&& 
key, mapped_type 
val,
 
  400            const Context_t& ctx = Updater_t::defaultContext());
 
  415   std::pair<const_iterator, bool>
 
  416   emplace (
const Lock_t& 
lock,
 
  417            key_type&& 
key, mapped_type 
val,
 
  418            const Context_t& ctx = Updater_t::defaultContext());
 
  432   std::pair<const_iterator, bool>
 
  433   insert_or_assign (
const key_type& 
key, mapped_type 
val,
 
  434                     const Context_t& ctx = Updater_t::defaultContext());
 
  450   std::pair<const_iterator, bool>
 
  451   insert_or_assign (
const Lock_t& 
lock,
 
  452                     const key_type& 
key, mapped_type 
val,
 
  453                     const Context_t& ctx = Updater_t::defaultContext());
 
  467   std::pair<const_iterator, bool>
 
  468   insert_or_assign (key_type&& 
key, mapped_type 
val,
 
  469                     const Context_t& ctx = Updater_t::defaultContext());
 
  485   std::pair<const_iterator, bool>
 
  486   insert_or_assign (
const Lock_t& 
lock,
 
  487                     key_type&& 
key, mapped_type 
val,
 
  488                     const Context_t& ctx = Updater_t::defaultContext());
 
  505   template <
class PAIR>
 
  506   std::pair<const_iterator, bool> insert (
const PAIR& 
p,
 
  507                                           const Context_t& ctx = Updater_t::defaultContext());
 
  522   template <
class PAIR>
 
  523   std::pair<const_iterator, bool> insert (PAIR&& 
p,
 
  524                                           const Context_t& ctx = Updater_t::defaultContext());
 
  536   template <
class InputIterator>
 
  537   void insert (InputIterator 
first, InputIterator last,
 
  538                const Context_t& ctx = Updater_t::defaultContext());
 
  549   void reserve (size_type capacity,
 
  550                 const Context_t& ctx = Updater_t::defaultContext());
 
  560   void rehash (size_type capacity);
 
  568   void quiescent (
const Context_t& ctx);
 
  587   Updater_t& updater();
 
  595   static const std::string* keyAsString (val_t 
val);
 
  602   static val_t keyAsVal (
const std::string* 
s);
 
  609   static mapped_type mappedAsMapped (val_t 
val);
 
  616   static val_t mappedAsVal (mapped_type 
val);
 
  626   typename Impl_t::const_iterator 
get (
const key_type& 
key) 
const;
 
  640   std::pair<const_iterator, bool>
 
  641   put (std::unique_ptr<key_type> 
key,
 
  643        bool overwrite = 
true,
 
  644        const Context_t& ctx = Updater_t::defaultContext());
 
  658   std::pair<const_iterator, bool>
 
  659   put (
const Lock_t& 
lock,
 
  660        std::unique_ptr<key_type> 
key,
 
  662        bool overwrite = 
true,
 
  663        const Context_t& ctx = Updater_t::defaultContext());
 
  679     std::hash<std::string> m_hash;
 
  704 #endif // not CXXUTILS_CONCURRENTSTRMAP_H