Classes | Public Types | Public Member Functions | Public Attributes | List of all members
shims::map< Key, T, Compare, Allocator > Class Template Reference

#include <stdmap_shims.h>

Classes

struct  iter
 
struct  iterator_tuple
 
struct  maps_tuple
 

Public Types

using mapmap_t = std::map< const Key, T, Compare, Allocator >
 
using listmap_t = std::list< std::pair< const Key, T >, Allocator >
 
using size_type = typename mapmap_t::size_type
 
using iterator_tag = std::input_iterator_tag
 
using iterator = iter< iterator_tag, std::pair< const Key, T >>
 
using const_iterator = iter< iterator_tag, const std::pair< const Key, T >>
 

Public Member Functions

T & operator[] (Key const &key)
 
iterator begin ()
 
const_iterator begin () const
 
const_iterator cbegin () const
 
iterator end ()
 
const_iterator end () const
 
const_iterator cend () const
 
T & at (Key const &key)
 
T const & at (Key const &key) const
 
iterator find (Key const &key)
 
const_iterator find (Key const &key) const
 
size_t erase (Key const &key)
 
bool empty () const
 
size_type size () const
 
iterator erase (iterator it)
 
iterator erase (const_iterator &it)
 
template<class... Args>
std::pair< iterator, boolemplace (Args &&...args)
 

Public Attributes

maps_tuple _maps
 

Detailed Description

template<class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
class shims::map< Key, T, Compare, Allocator >

Definition at line 21 of file stdmap_shims.h.

Member Typedef Documentation

template<class Key , class T , class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
using shims::map< Key, T, Compare, Allocator >::const_iterator = iter<iterator_tag, const std::pair<const Key, T>>

Definition at line 128 of file stdmap_shims.h.

template<class Key , class T , class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
using shims::map< Key, T, Compare, Allocator >::iterator = iter<iterator_tag, std::pair<const Key, T>>

Definition at line 127 of file stdmap_shims.h.

template<class Key , class T , class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
using shims::map< Key, T, Compare, Allocator >::iterator_tag = std::input_iterator_tag

Definition at line 41 of file stdmap_shims.h.

template<class Key , class T , class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
using shims::map< Key, T, Compare, Allocator >::listmap_t = std::list<std::pair<const Key, T>, Allocator>

Definition at line 24 of file stdmap_shims.h.

template<class Key , class T , class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
using shims::map< Key, T, Compare, Allocator >::mapmap_t = std::map<const Key, T, Compare, Allocator>

Definition at line 23 of file stdmap_shims.h.

template<class Key , class T , class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
using shims::map< Key, T, Compare, Allocator >::size_type = typename mapmap_t::size_type

Definition at line 39 of file stdmap_shims.h.

Member Function Documentation

template<class Key , class T , class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
T& shims::map< Key, T, Compare, Allocator >::at ( Key const &  key)
inline

Definition at line 193 of file stdmap_shims.h.

194  {
195  if (isSnippetMode()) {
196  auto it =
197  std::find_if(_maps.listmap.begin(),
198  _maps.listmap.end(),
199  [&key](auto& element) { return element.first == key; });
200  if (it == _maps.listmap.end())
201  throw std::out_of_range("Key <" + key + "> not found.");
202  return it->second;
203  } else {
204  return _maps.mapmap.at(key);
205  }
206  }
bool isSnippetMode(bool m)
Definition: parse_shims.cc:9
maps_tuple _maps
Definition: stdmap_shims.h:320
def key(type, name=None)
Definition: graph.py:13
template<class Key , class T , class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
T const& shims::map< Key, T, Compare, Allocator >::at ( Key const &  key) const
inline

Definition at line 209 of file stdmap_shims.h.

210  {
211  if (isSnippetMode()) {
212  auto it = std::find_if(
213  _maps.listmap.cbegin(),
214  _maps.listmap.cend(),
215  [&key](auto const& element) { return element.first == key; });
216  if (it == _maps.listmap.cend())
217  throw std::out_of_range("Key <" + key + "> not found.");
218  return it->second;
219  } else {
220  return _maps.mapmap.at(key);
221  }
222  }
bool isSnippetMode(bool m)
Definition: parse_shims.cc:9
maps_tuple _maps
Definition: stdmap_shims.h:320
def key(type, name=None)
Definition: graph.py:13
template<class Key , class T , class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
iterator shims::map< Key, T, Compare, Allocator >::begin ( )
inline

Definition at line 150 of file stdmap_shims.h.

151  {
154  }
bool isSnippetMode(bool m)
Definition: parse_shims.cc:9
maps_tuple _maps
Definition: stdmap_shims.h:320
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
template<class Key , class T , class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
const_iterator shims::map< Key, T, Compare, Allocator >::begin ( ) const
inline

Definition at line 157 of file stdmap_shims.h.

158  {
159  maps_tuple& maps = *const_cast<maps_tuple*>(&_maps);
160  return isSnippetMode() ? const_iterator{std::begin(maps.listmap)} :
161  const_iterator{std::begin(maps.mapmap)};
162  }
bool isSnippetMode(bool m)
Definition: parse_shims.cc:9
maps_tuple _maps
Definition: stdmap_shims.h:320
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
template<class Key , class T , class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
const_iterator shims::map< Key, T, Compare, Allocator >::cbegin ( ) const
inline

Definition at line 165 of file stdmap_shims.h.

166  {
167  return begin();
168  }
iterator begin()
Definition: stdmap_shims.h:150
template<class Key , class T , class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
const_iterator shims::map< Key, T, Compare, Allocator >::cend ( ) const
inline

Definition at line 187 of file stdmap_shims.h.

188  {
189  return end();
190  }
iterator end()
Definition: stdmap_shims.h:171
template<class Key , class T , class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
template<class... Args>
std::pair<iterator, bool> shims::map< Key, T, Compare, Allocator >::emplace ( Args &&...  args)
inline

Definition at line 309 of file stdmap_shims.h.

310  {
311  if (isSnippetMode()) {
312  _maps.listmap.emplace_back(std::forward<Args>(args)...);
313  return std::make_pair(iterator{std::prev(_maps.listmap.end())}, true);
314  } else {
315  auto result = _maps.mapmap.emplace(std::forward<Args>(args)...);
316  return std::make_pair(iterator{result.first}, result.second);
317  }
318  }
bool isSnippetMode(bool m)
Definition: parse_shims.cc:9
static QCString result
maps_tuple _maps
Definition: stdmap_shims.h:320
static QCString args
Definition: declinfo.cpp:674
template<class Key , class T , class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
bool shims::map< Key, T, Compare, Allocator >::empty ( ) const
inline

Definition at line 276 of file stdmap_shims.h.

277  {
278  return isSnippetMode() ? _maps.listmap.empty() : _maps.mapmap.empty();
279  }
bool isSnippetMode(bool m)
Definition: parse_shims.cc:9
maps_tuple _maps
Definition: stdmap_shims.h:320
template<class Key , class T , class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
iterator shims::map< Key, T, Compare, Allocator >::end ( )
inline

Definition at line 171 of file stdmap_shims.h.

172  {
175  }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
bool isSnippetMode(bool m)
Definition: parse_shims.cc:9
maps_tuple _maps
Definition: stdmap_shims.h:320
template<class Key , class T , class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
const_iterator shims::map< Key, T, Compare, Allocator >::end ( ) const
inline

Definition at line 178 of file stdmap_shims.h.

179  {
180  maps_tuple& maps = *const_cast<maps_tuple*>(&_maps);
181 
182  return isSnippetMode() ? const_iterator{std::end(maps.listmap)} :
183  const_iterator{std::end(maps.mapmap)};
184  }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
bool isSnippetMode(bool m)
Definition: parse_shims.cc:9
maps_tuple _maps
Definition: stdmap_shims.h:320
template<class Key , class T , class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
size_t shims::map< Key, T, Compare, Allocator >::erase ( Key const &  key)
inline

Definition at line 253 of file stdmap_shims.h.

254  {
255  if (isSnippetMode()) {
256  auto erase_count = size_t{0};
257  auto i = _maps.listmap.begin();
258  auto e = _maps.listmap.end();
259 
260  while (i != e) {
261  if (key == i->first) {
262  i = _maps.listmap.erase(i);
263  ++erase_count;
264  } else {
265  i++;
266  }
267  }
268 
269  return erase_count;
270  } else {
271  return _maps.mapmap.erase(key);
272  }
273  }
bool isSnippetMode(bool m)
Definition: parse_shims.cc:9
maps_tuple _maps
Definition: stdmap_shims.h:320
const double e
def key(type, name=None)
Definition: graph.py:13
template<class Key , class T , class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
iterator shims::map< Key, T, Compare, Allocator >::erase ( iterator  it)
inline

Definition at line 288 of file stdmap_shims.h.

289  {
290  if (isSnippetMode()) {
291  return _maps.listmap.erase(it.get(typename listmap_t::iterator{}));
292  } else {
293  return _maps.mapmap.erase(it.get(typename mapmap_t::iterator{}));
294  }
295  }
intermediate_table::iterator iterator
bool isSnippetMode(bool m)
Definition: parse_shims.cc:9
maps_tuple _maps
Definition: stdmap_shims.h:320
std::enable_if_t< std::is_same_v< typename mapmap_t::iterator, II >, II > get(II)
Definition: stdmap_shims.h:94
template<class Key , class T , class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
iterator shims::map< Key, T, Compare, Allocator >::erase ( const_iterator it)
inline

Definition at line 298 of file stdmap_shims.h.

299  {
300  if (isSnippetMode()) {
301  return _maps.listmap.erase(it.get(typename listmap_t::iterator{}));
302  } else {
303  return _maps.mapmap.erase(it.get(typename mapmap_t::iterator{}));
304  }
305  }
intermediate_table::iterator iterator
bool isSnippetMode(bool m)
Definition: parse_shims.cc:9
maps_tuple _maps
Definition: stdmap_shims.h:320
std::enable_if_t< std::is_same_v< typename mapmap_t::iterator, II >, II > get(II)
Definition: stdmap_shims.h:94
template<class Key , class T , class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
iterator shims::map< Key, T, Compare, Allocator >::find ( Key const &  key)
inline

Definition at line 225 of file stdmap_shims.h.

226  {
227  if (isSnippetMode()) {
228  return std::find_if(
229  _maps.listmap.begin(), _maps.listmap.end(), [&key](auto& element) {
230  return element.first == key;
231  });
232  } else {
233  return _maps.mapmap.find(key);
234  }
235  }
bool isSnippetMode(bool m)
Definition: parse_shims.cc:9
maps_tuple _maps
Definition: stdmap_shims.h:320
def key(type, name=None)
Definition: graph.py:13
template<class Key , class T , class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
const_iterator shims::map< Key, T, Compare, Allocator >::find ( Key const &  key) const
inline

Definition at line 238 of file stdmap_shims.h.

239  {
240  maps_tuple& maps = *const_cast<maps_tuple*>(&_maps);
241 
242  if (isSnippetMode()) {
243  return std::find_if(
244  maps.listmap.begin(),
245  maps.listmap.end(),
246  [&key](auto const& element) { return element.first == key; });
247  } else {
248  return maps.mapmap.find(key);
249  }
250  }
bool isSnippetMode(bool m)
Definition: parse_shims.cc:9
maps_tuple _maps
Definition: stdmap_shims.h:320
def key(type, name=None)
Definition: graph.py:13
template<class Key , class T , class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
T& shims::map< Key, T, Compare, Allocator >::operator[] ( Key const &  key)
inline

Definition at line 135 of file stdmap_shims.h.

136  {
137  if (isSnippetMode()) {
138  for (auto& element : _maps.listmap) {
139  if (element.first == key)
140  return element.second;
141  }
142  _maps.listmap.emplace_back(std::make_pair(key, T{}));
143  return _maps.listmap.back().second;
144  } else {
145  return _maps.mapmap[key];
146  }
147  }
bool isSnippetMode(bool m)
Definition: parse_shims.cc:9
maps_tuple _maps
Definition: stdmap_shims.h:320
def key(type, name=None)
Definition: graph.py:13
template<class Key , class T , class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
size_type shims::map< Key, T, Compare, Allocator >::size ( ) const
inline

Definition at line 282 of file stdmap_shims.h.

283  {
284  return isSnippetMode() ? _maps.listmap.size() : _maps.mapmap.size();
285  }
bool isSnippetMode(bool m)
Definition: parse_shims.cc:9
maps_tuple _maps
Definition: stdmap_shims.h:320

Member Data Documentation

template<class Key , class T , class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
maps_tuple shims::map< Key, T, Compare, Allocator >::_maps

Definition at line 320 of file stdmap_shims.h.


The documentation for this class was generated from the following file: