43 class Compare = std::less<Key>,
44 class Allocator = std::allocator<std::pair<const Key, T>>>
104 const Allocator& alloc = Allocator());
111 const Allocator& alloc = Allocator());
121 const Allocator& alloc,
126 G4AccMap(std::initializer_list<std::pair<const Key,T>> init,
128 const Compare& comp = Compare(),
129 const Allocator& alloc = Allocator());
134 std::initializer_list<std::pair<const Key,T>> init,
136 const Compare& comp = Compare(),
137 const Allocator& alloc = Allocator());
152 inline T&
operator[](Key&& key) {
return fMap[std::move(key)]; }
154 inline T&
at(
const Key& key) {
return fMap[key]; }
155 inline const T&
at(
const Key& key )
const {
return fMap[key]; }
157 inline typename std::map<Key, T, Compare, Allocator>::size_type
size()
const {
return fMap.size(); }
159 inline typename std::map<Key, T, Compare, Allocator>::iterator
begin() {
return fMap.begin(); }
160 inline typename std::map<Key, T, Compare, Allocator>::const_iterator
begin()
const {
return fMap.begin(); }
161 inline typename std::map<Key, T, Compare, Allocator>::const_iterator
cbegin()
const {
return fMap.cbegin(); }
163 inline typename std::map<Key, T, Compare, Allocator>::iterator
end() {
return fMap.end(); }
164 inline typename std::map<Key, T, Compare, Allocator>::const_iterator
end()
const {
return fMap.end(); }
165 inline typename std::map<Key, T, Compare, Allocator>::const_iterator
cend()
const {
return fMap.cend(); }
167 inline void clear() { fMap.clear(); }
169 inline std::pair<typename std::map<Key, T, Compare, Allocator>::iterator,
bool>
insert(
const T& value) {
return fMap.insert(value); }
171 inline std::pair<typename std::map<Key, T, Compare, Allocator>::iterator,
bool>
insert( P&& value ) {
return fMap.insert(std::move(value)); }
172 inline std::pair<typename std::map<Key, T, Compare, Allocator>::iterator,
bool>
insert( T&& value ) {
return fMap.insert(std::move(value)); }
174 inline typename std::map<Key, T, Compare, Allocator>::iterator
find(
const Key& key ) {
return fMap.find(key); }
175 inline typename std::map<Key, T, Compare, Allocator>::const_iterator
find(
const Key& key )
const {
return fMap.find(key); }
186 std::map<Key, T, Compare, Allocator>&
GetMap() {
return fMap; }
187 const std::map<Key, T, Compare, Allocator>&
GetMap()
const {
return fMap; }
191 std::map<Key, T, Compare, Allocator> fMap {};
198#include "G4AccMap.icc"
std::function< T(const T &, const T &)> G4MergeFunction
G4AccMap(const G4String &name, std::initializer_list< std::pair< const Key, T > > init, G4MergeMode mergeMode=G4MergeMode::kAddition, const Compare &comp=Compare(), const Allocator &alloc=Allocator())
G4AccMap(const G4String &name, const Compare &comp, G4MergeMode mergeMode=G4MergeMode::kAddition, const Allocator &alloc=Allocator())
G4AccMap(G4AccMap &&rhs)=default
G4AccMap(G4AccMap &&rhs, const Allocator &allocator)
T & operator[](Key &&key)
void SetMergeMode(G4MergeMode value) final
std::map< Key, T, Compare, Allocator >::iterator find(const Key &key)
std::map< Key, T, Compare, Allocator >::const_iterator find(const Key &key) const
void Print(G4PrintOptions options=G4PrintOptions()) const final
std::map< Key, T, Compare, Allocator >::const_iterator cbegin() const
std::map< Key, T, Compare, Allocator >::const_iterator end() const
G4AccMap(const Compare &comp, G4MergeMode mergeMode=G4MergeMode::kAddition, const Allocator &alloc=Allocator())
G4AccMap(const G4AccMap &rhs, const Allocator &allocator)
G4AccMap(const G4String &name="", G4MergeMode mergeMode=G4MergeMode::kAddition)
T & operator[](const Key &key)
void SetInitValue(const T &value)
const std::map< Key, T, Compare, Allocator > & GetMap() const
G4AccMap(const Allocator &alloc, G4MergeMode mergeMode=G4MergeMode::kAddition)
std::pair< typename std::map< Key, T, Compare, Allocator >::iterator, bool > insert(P &&value)
std::map< Key, T, Compare, Allocator >::iterator begin()
const T & at(const Key &key) const
void Merge(const G4VAccumulable &other) final
G4AccType GetType() const final
~G4AccMap() override=default
std::map< Key, T, Compare, Allocator >::size_type size() const
G4AccMap(std::initializer_list< std::pair< const Key, T > > init, G4MergeMode mergeMode=G4MergeMode::kAddition, const Compare &comp=Compare(), const Allocator &alloc=Allocator())
G4AccMap(const G4String &name, const Allocator &alloc, G4MergeMode mergeMode=G4MergeMode::kAddition)
std::pair< typename std::map< Key, T, Compare, Allocator >::iterator, bool > insert(const T &value)
std::map< Key, T, Compare, Allocator >::iterator end()
std::pair< typename std::map< Key, T, Compare, Allocator >::iterator, bool > insert(T &&value)
std::map< Key, T, Compare, Allocator >::const_iterator begin() const
std::map< Key, T, Compare, Allocator >::const_iterator cend() const
G4AccMap(const G4AccMap &rhs)=default
std::map< Key, T, Compare, Allocator > & GetMap()
G4VAccumulable(G4MergeMode mergeMode=G4MergeMode::kAddition)