31#ifndef G4AccUnorderedMap_h
32#define G4AccUnorderedMap_h 1
39#include <unordered_map>
43 class Hash = std::hash<Key>,
44 class KeyEqual = std::equal_to<Key>,
45 class Allocator = std::allocator<std::pair<const Key, T>>>
131 const Allocator& alloc = Allocator());
136 std::size_t bucket_count,
138 const Allocator& alloc = Allocator());
143 const Allocator& alloc,
149 std::size_t bucket_count,
150 const Allocator& alloc,
156 const Allocator& alloc,
162 std::size_t bucket_count,
164 const Allocator& alloc,
174 const Allocator& alloc,
181 std::size_t bucket_count = 0,
182 const Hash& hash = Hash(),
183 const KeyEqual& equal = KeyEqual(),
184 const Allocator& alloc = Allocator() );
189 std::initializer_list<std::pair<const Key,T>> init,
191 std::size_t bucket_count = 0,
192 const Hash& hash = Hash(),
193 const KeyEqual& equal = KeyEqual(),
194 const Allocator& alloc = Allocator() );
209 inline T&
operator[](Key&& key) {
return fUMap[std::move(key)]; }
211 inline T&
at(
const Key& key) {
return fUMap[key]; }
212 inline const T&
at(
const Key& key )
const {
return fUMap[key]; }
214 inline typename std::unordered_map<Key, T, Hash, KeyEqual, Allocator>::size_type
size()
const {
return fUMap.size(); }
216 inline typename std::unordered_map<Key, T, Hash, KeyEqual, Allocator>::iterator
begin() {
return fUMap.begin(); }
217 inline typename std::unordered_map<Key, T, Hash, KeyEqual, Allocator>::const_iterator
begin()
const {
return fUMap.begin(); }
218 inline typename std::unordered_map<Key, T, Hash, KeyEqual, Allocator>::const_iterator
cbegin()
const {
return fUMap.cbegin(); }
220 inline typename std::unordered_map<Key, T, Hash, KeyEqual, Allocator>::iterator
end() {
return fUMap.end(); }
221 inline typename std::unordered_map<Key, T, Hash, KeyEqual, Allocator>::const_iterator
end()
const {
return fUMap.end(); }
222 inline typename std::unordered_map<Key, T, Hash, KeyEqual, Allocator>::const_iterator
cend()
const {
return fUMap.cend(); }
224 inline void clear() { fUMap.clear(); }
226 inline std::pair<typename std::unordered_map<Key, T, Hash, KeyEqual, Allocator>::iterator,
bool>
insert(
const T& value) {
return fUMap.insert(value); }
228 inline std::pair<typename std::unordered_map<Key, T, Hash, KeyEqual, Allocator>::iterator,
bool>
insert( P&& value ) {
return fUMap.insert(std::move(value)); }
229 inline std::pair<typename std::unordered_map<Key, T, Hash, KeyEqual, Allocator>::iterator,
bool>
insert( T&& value ) {
return fUMap.insert(std::move(value)); }
231 inline typename std::unordered_map<Key, T, Hash, KeyEqual, Allocator>::iterator
find(
const Key& key ) {
return fUMap.find(key); }
232 inline typename std::unordered_map<Key, T, Hash, KeyEqual, Allocator>::const_iterator
find(
const Key& key )
const {
return fUMap.find(key); }
243 std::unordered_map<Key, T, Hash, KeyEqual, Allocator>&
GetUnorderedMap() {
return fUMap; }
244 const std::unordered_map<Key, T, Hash, KeyEqual, Allocator>&
GetUnorderedMap()
const {
return fUMap; }
248 std::unordered_map<Key, T, Hash, KeyEqual, Allocator> fUMap;
255#include "G4AccUnorderedMap.icc"
std::function< T(const T &, const T &)> G4MergeFunction
G4AccUnorderedMap(const G4String &name, std::size_t bucket_count, const Allocator &alloc, G4MergeMode mergeMode=G4MergeMode::kAddition)
std::pair< typename std::unordered_map< Key, T, Hash, KeyEqual, Allocator >::iterator, bool > insert(const T &value)
void Print(G4PrintOptions options=G4PrintOptions()) const final
G4AccUnorderedMap(const G4AccUnorderedMap &rhs)=default
G4AccUnorderedMap(const G4String &name="", G4MergeMode mergeMode=G4MergeMode::kAddition)
T & operator[](Key &&key)
G4AccUnorderedMap(std::initializer_list< std::pair< const Key, T > > init, G4MergeMode mergeMode=G4MergeMode::kAddition, std::size_t bucket_count=0, const Hash &hash=Hash(), const KeyEqual &equal=KeyEqual(), const Allocator &alloc=Allocator())
G4AccUnorderedMap(std::size_t bucket_count, const Hash &hash, const Allocator &alloc, G4MergeMode mergeMode=G4MergeMode::kAddition)
G4AccUnorderedMap(std::size_t bucket_count, G4MergeMode mergeMode=G4MergeMode::kAddition, const Allocator &alloc=Allocator())
G4AccUnorderedMap(G4AccUnorderedMap &&rhs, const Allocator &allocator)
std::unordered_map< Key, T, Hash, KeyEqual, Allocator >::size_type size() const
G4AccUnorderedMap(G4AccUnorderedMap &&rhs)=default
std::pair< typename std::unordered_map< Key, T, Hash, KeyEqual, Allocator >::iterator, bool > insert(P &&value)
G4AccUnorderedMap(const G4String &name, std::size_t bucket_count, G4MergeMode mergeMode=G4MergeMode::kAddition, const Allocator &alloc=Allocator())
std::unordered_map< Key, T, Hash, KeyEqual, Allocator >::iterator find(const Key &key)
T & operator[](const Key &key)
std::unordered_map< Key, T, Hash, KeyEqual, Allocator >::iterator end()
std::unordered_map< Key, T, Hash, KeyEqual, Allocator >::const_iterator cend() const
G4AccUnorderedMap(const G4String &name, std::size_t bucket_count, const Hash &hash, const Allocator &alloc, G4MergeMode mergeMode=G4MergeMode::kAddition)
void SetMergeMode(G4MergeMode value) final
void Merge(const G4VAccumulable &other) final
std::unordered_map< Key, T, Hash, KeyEqual, Allocator >::const_iterator find(const Key &key) const
std::unordered_map< Key, T, Hash, KeyEqual, Allocator >::iterator begin()
~G4AccUnorderedMap() override=default
G4AccUnorderedMap(const G4String &name, const Allocator &alloc, G4MergeMode mergeMode=G4MergeMode::kAddition)
const T & at(const Key &key) const
G4AccUnorderedMap(const Allocator &alloc, G4MergeMode mergeMode=G4MergeMode::kAddition)
std::unordered_map< Key, T, Hash, KeyEqual, Allocator >::const_iterator begin() const
std::unordered_map< Key, T, Hash, KeyEqual, Allocator >::const_iterator end() const
std::pair< typename std::unordered_map< Key, T, Hash, KeyEqual, Allocator >::iterator, bool > insert(T &&value)
std::unordered_map< Key, T, Hash, KeyEqual, Allocator >::const_iterator cbegin() const
std::unordered_map< Key, T, Hash, KeyEqual, Allocator > & GetUnorderedMap()
void SetInitValue(const T &value)
const std::unordered_map< Key, T, Hash, KeyEqual, Allocator > & GetUnorderedMap() const
G4AccUnorderedMap(const G4String &name, std::initializer_list< std::pair< const Key, T > > init, G4MergeMode mergeMode=G4MergeMode::kAddition, std::size_t bucket_count=0, const Hash &hash=Hash(), const KeyEqual &equal=KeyEqual(), const Allocator &alloc=Allocator())
G4AccType GetType() const final
G4AccUnorderedMap(const G4AccUnorderedMap &rhs, const Allocator &allocator)
G4AccUnorderedMap(std::size_t bucket_count, const Allocator &alloc, G4MergeMode mergeMode=G4MergeMode::kAddition)
G4VAccumulable(G4MergeMode mergeMode=G4MergeMode::kAddition)