alternative Standard Libary  0.29.8
std::map< Tk, Tv, TAllocator > Template-Klassenreferenz

#include <map.hpp>

Öffentliche Typen

using key_type = Tk
 
using data_type = Tv
 
using value_type = map_pair< Tk, Tv >
 
using tree_type = rb_tree_base< map_traits< Tk, Tv > >
 
using size_type = tree_type::size_type
 
using iterator = node_iterator< typename tree_type::node *, value_type *, value_type & >
 
using const_iterator = node_iterator< typename tree_type::node *, const value_type *, const value_type & >
 
using allocator_type = TAllocator
 

Öffentliche Methoden

 map (const allocator_type &allocator=allocator_type())
 
template<typename TInputIterator >
 map (TInputIterator dataBegin, TInputIterator dataEnd, const allocator_type &allocator=allocator_type())
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
data_typeoperator[] (const key_type &key)
 
iterator insert (const value_type &v)
 
iterator find (const key_type &key)
 
size_type erase (const key_type &key)
 
void clear ()
 
void swap (map &other)
 
bool empty () const
 
size_type size () const
 

Ausführliche Beschreibung

template<typename Tk, typename Tv, class TAllocator = std::allocator>
class std::map< Tk, Tv, TAllocator >

Dokumentation der benutzerdefinierten Datentypen

◆ allocator_type

template<typename Tk , typename Tv , class TAllocator = std::allocator>
using std::map< Tk, Tv, TAllocator >::allocator_type = TAllocator

◆ const_iterator

template<typename Tk , typename Tv , class TAllocator = std::allocator>
using std::map< Tk, Tv, TAllocator >::const_iterator = node_iterator<typename tree_type::node*, const value_type*, const value_type&>

◆ data_type

template<typename Tk , typename Tv , class TAllocator = std::allocator>
using std::map< Tk, Tv, TAllocator >::data_type = Tv

◆ iterator

template<typename Tk , typename Tv , class TAllocator = std::allocator>
using std::map< Tk, Tv, TAllocator >::iterator = node_iterator<typename tree_type::node*, value_type*, value_type&>

◆ key_type

template<typename Tk , typename Tv , class TAllocator = std::allocator>
using std::map< Tk, Tv, TAllocator >::key_type = Tk

◆ size_type

template<typename Tk , typename Tv , class TAllocator = std::allocator>
using std::map< Tk, Tv, TAllocator >::size_type = tree_type::size_type

◆ tree_type

template<typename Tk , typename Tv , class TAllocator = std::allocator>
using std::map< Tk, Tv, TAllocator >::tree_type = rb_tree_base<map_traits<Tk, Tv> >

◆ value_type

template<typename Tk , typename Tv , class TAllocator = std::allocator>
using std::map< Tk, Tv, TAllocator >::value_type = map_pair<Tk, Tv>

Beschreibung der Konstruktoren und Destruktoren

◆ map() [1/2]

template<typename Tk , typename Tv , class TAllocator = std::allocator>
std::map< Tk, Tv, TAllocator >::map ( const allocator_type allocator = allocator_type())
inlineexplicit
143  : m_tree(allocator)
144  {
145 
146  }

◆ map() [2/2]

template<typename Tk , typename Tv , class TAllocator = std::allocator>
template<typename TInputIterator >
std::map< Tk, Tv, TAllocator >::map ( TInputIterator  dataBegin,
TInputIterator  dataEnd,
const allocator_type allocator = allocator_type() 
)
inline
149  : m_tree(allocator)
150  {
151  TInputIterator it = dataBegin;
152  while (it != dataEnd)
153  {
154  insert(*it);
155  ++it;
156  }
157  }
iterator insert(const value_type &v)
Definition: map.hpp:184

Dokumentation der Elementfunktionen

◆ begin() [1/2]

template<typename Tk , typename Tv , class TAllocator = std::allocator>
iterator std::map< Tk, Tv, TAllocator >::begin ( )
inline
160  {
161  return iterator(m_tree.get_begin_node(), this);
162  }
node_iterator< typename tree_type::node *, value_type *, value_type & > iterator
Definition: map.hpp:138
node * get_begin_node() const
Definition: rb_tree.hpp:263

◆ begin() [2/2]

template<typename Tk , typename Tv , class TAllocator = std::allocator>
const_iterator std::map< Tk, Tv, TAllocator >::begin ( ) const
inline
164  {
165  return const_iterator(m_tree.get_begin_node(), this);
166  }
node_iterator< typename tree_type::node *, const value_type *, const value_type & > const_iterator
Definition: map.hpp:139
node * get_begin_node() const
Definition: rb_tree.hpp:263

◆ clear()

template<typename Tk , typename Tv , class TAllocator = std::allocator>
void std::map< Tk, Tv, TAllocator >::clear ( )
inline
197 { m_tree.clear(); }
void clear()
Definition: rb_tree.hpp:211

◆ empty()

template<typename Tk , typename Tv , class TAllocator = std::allocator>
bool std::map< Tk, Tv, TAllocator >::empty ( ) const
inline
204  {
205  return m_tree.empty();
206  }
bool empty() const
Definition: rb_tree.hpp:232

◆ end() [1/2]

template<typename Tk , typename Tv , class TAllocator = std::allocator>
iterator std::map< Tk, Tv, TAllocator >::end ( )
inline
168  {
169  return iterator(0, this);
170  }
node_iterator< typename tree_type::node *, value_type *, value_type & > iterator
Definition: map.hpp:138

◆ end() [2/2]

template<typename Tk , typename Tv , class TAllocator = std::allocator>
const_iterator std::map< Tk, Tv, TAllocator >::end ( ) const
inline
172  {
173  return const_iterator(0, this);
174  }
node_iterator< typename tree_type::node *, const value_type *, const value_type & > const_iterator
Definition: map.hpp:139

◆ erase()

template<typename Tk , typename Tv , class TAllocator = std::allocator>
size_type std::map< Tk, Tv, TAllocator >::erase ( const key_type key)
inline
194  {
195  return m_tree.erase(key);
196  }
size_type erase(const key_type &key)
Definition: rb_tree.hpp:159

◆ find()

template<typename Tk , typename Tv , class TAllocator = std::allocator>
iterator std::map< Tk, Tv, TAllocator >::find ( const key_type key)
inline
190  {
191  return iterator(m_tree.find_node(key), this);
192  }
node_iterator< typename tree_type::node *, value_type *, value_type & > iterator
Definition: map.hpp:138
node * find_node(const key_type &key)
Definition: rb_tree.hpp:143

◆ insert()

template<typename Tk , typename Tv , class TAllocator = std::allocator>
iterator std::map< Tk, Tv, TAllocator >::insert ( const value_type v)
inline
185  {
186  typename tree_type::node* n = m_tree.insert(v);
187  return iterator(n, this);
188  }
node * insert(const value_type &v)
Definition: rb_tree.hpp:104
node_iterator< typename tree_type::node *, value_type *, value_type & > iterator
Definition: map.hpp:138

◆ operator[]()

template<typename Tk , typename Tv , class TAllocator = std::allocator>
data_type& std::map< Tk, Tv, TAllocator >::operator[] ( const key_type key)
inline
178  {
179  typename tree_type::node* n = m_tree.find_node(key);
180  if (n == 0)
181  n = m_tree.insert(value_type(key, Tv()));
182  return n->value.second;
183  }
map_pair< Tk, Tv > value_type
Definition: map.hpp:135
node * insert(const value_type &v)
Definition: rb_tree.hpp:104
node * find_node(const key_type &key)
Definition: rb_tree.hpp:143

◆ size()

template<typename Tk , typename Tv , class TAllocator = std::allocator>
size_type std::map< Tk, Tv, TAllocator >::size ( ) const
inline
208  {
209  return m_tree.size();
210  }
size_type size() const
Definition: rb_tree.hpp:236

◆ swap()

template<typename Tk , typename Tv , class TAllocator = std::allocator>
void std::map< Tk, Tv, TAllocator >::swap ( map< Tk, Tv, TAllocator > &  other)
inline
199  {
200  m_tree.swap(other.m_tree);
201  }
void swap(rb_tree_base &other)
Definition: rb_tree.hpp:220

Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Datei: