alternative Standard Libary  0.29.8
std::sorted_vector< TKey, TValue, TCompare, TAllocator, TStorage > Template-Klassenreferenz

#include <sorted_vector.hpp>

+ Klassendiagramm für std::sorted_vector< TKey, TValue, TCompare, TAllocator, TStorage >:
+ Zusammengehörigkeiten von std::sorted_vector< TKey, TValue, TCompare, TAllocator, TStorage >:

Öffentliche Typen

using key_type = TKey
 
using mapped_type = TValue
 
using size_type = Base::size_type
 
using value_type = Base::value_type
 
using iterator = Base::iterator
 
using const_iterator = Base::const_iterator
 
using allocator_type = Base::allocator_type
 

Öffentliche Methoden

 sorted_vector (const allocator_type &allocator=allocator_type())
 
template<class InputIterator >
 sorted_vector (InputIterator first, InputIterator last, const allocator_type &allocator=allocator_type())
 
pair< iterator, bool > insert (const value_type &val)
 
pair< iterator, bool > insert (const key_type &k, const mapped_type &v)
 
iterator find (const key_type &k)
 
const_iterator find (const key_type &k) const
 
iterator erase (iterator it)
 
size_type erase (const key_type &k)
 
iterator lower_bound (const key_type &k)
 
const_iterator lower_bound (const key_type &k) const
 
iterator upper_bound (const key_type &k)
 
const_iterator upper_bound (const key_type &k) const
 

Private Methoden

void copy (const vector &rhs)
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
size_type size () const
 
bool empty () const
 
size_type capacity () const
 
pair< TKey, TValue > * data ()
 
const pair< TKey, TValue > * data () const
 
pair< TKey, TValue > & front ()
 
const pair< TKey, TValue > & front () const
 
pair< TKey, TValue > & back ()
 
const pair< TKey, TValue > & back () const
 
pair< TKey, TValue > & operator[] (size_type i)
 
const pair< TKey, TValue > & operator[] (size_type i) const
 
pair< TKey, TValue > & at (size_type i)
 
const pair< TKey, TValue > & at (size_type i) const
 
void push_back (const pair< TKey, TValue > &v)
 
void push_back ()
 
void pop_back ()
 
void assign (const pair< TKey, TValue > *first, const pair< TKey, TValue > *last)
 
void insert (size_type index, size_type n, const pair< TKey, TValue > &val)
 
void insert (iterator it, size_type n, const pair< TKey, TValue > &val)
 
iterator insert (iterator it, const pair< TKey, TValue > &val)
 
iterator erase (iterator first, iterator last)
 
void erase_unostdred (iterator it)
 
void resize (size_type n)
 
void reserve (size_type n)
 
void clear ()
 
void reset ()
 
void set_capacity (size_type newCapacity)
 
size_type index_of (const pair< TKey, TValue > &item, size_type index=0) const
 
iterator find (const pair< TKey, TValue > &item)
 
const allocator_typeget_allocator () const
 
void set_allocator (const allocator_type &allocator)
 
bool validate_iterator (const_iterator it) const
 
size_type get_high_watermark () const
 

Statische, private Attribute

static const size_type kInitialCapacity
 
static const size_type npos = size_type(-1)
 

Ausführliche Beschreibung

template<typename TKey, typename TValue, class TCompare = std::less<TKey>, class TAllocator = std::allocator, class TStorage = std::standard_vector_storage<pair<TKey, TValue>, TAllocator>>
class std::sorted_vector< TKey, TValue, TCompare, TAllocator, TStorage >

Dokumentation der benutzerdefinierten Datentypen

◆ allocator_type

template<typename TKey, typename TValue, class TCompare = std::less<TKey>, class TAllocator = std::allocator, class TStorage = std::standard_vector_storage<pair<TKey, TValue>, TAllocator>>
using std::sorted_vector< TKey, TValue, TCompare, TAllocator, TStorage >::allocator_type = Base::allocator_type

◆ const_iterator

template<typename TKey, typename TValue, class TCompare = std::less<TKey>, class TAllocator = std::allocator, class TStorage = std::standard_vector_storage<pair<TKey, TValue>, TAllocator>>
using std::sorted_vector< TKey, TValue, TCompare, TAllocator, TStorage >::const_iterator = Base::const_iterator

◆ iterator

template<typename TKey, typename TValue, class TCompare = std::less<TKey>, class TAllocator = std::allocator, class TStorage = std::standard_vector_storage<pair<TKey, TValue>, TAllocator>>
using std::sorted_vector< TKey, TValue, TCompare, TAllocator, TStorage >::iterator = Base::iterator

◆ key_type

template<typename TKey, typename TValue, class TCompare = std::less<TKey>, class TAllocator = std::allocator, class TStorage = std::standard_vector_storage<pair<TKey, TValue>, TAllocator>>
using std::sorted_vector< TKey, TValue, TCompare, TAllocator, TStorage >::key_type = TKey

◆ mapped_type

template<typename TKey, typename TValue, class TCompare = std::less<TKey>, class TAllocator = std::allocator, class TStorage = std::standard_vector_storage<pair<TKey, TValue>, TAllocator>>
using std::sorted_vector< TKey, TValue, TCompare, TAllocator, TStorage >::mapped_type = TValue

◆ size_type

template<typename TKey, typename TValue, class TCompare = std::less<TKey>, class TAllocator = std::allocator, class TStorage = std::standard_vector_storage<pair<TKey, TValue>, TAllocator>>
using std::sorted_vector< TKey, TValue, TCompare, TAllocator, TStorage >::size_type = Base::size_type

◆ value_type

template<typename TKey, typename TValue, class TCompare = std::less<TKey>, class TAllocator = std::allocator, class TStorage = std::standard_vector_storage<pair<TKey, TValue>, TAllocator>>
using std::sorted_vector< TKey, TValue, TCompare, TAllocator, TStorage >::value_type = Base::value_type

Beschreibung der Konstruktoren und Destruktoren

◆ sorted_vector() [1/2]

template<typename TKey, typename TValue, class TCompare = std::less<TKey>, class TAllocator = std::allocator, class TStorage = std::standard_vector_storage<pair<TKey, TValue>, TAllocator>>
std::sorted_vector< TKey, TValue, TCompare, TAllocator, TStorage >::sorted_vector ( const allocator_type allocator = allocator_type())
inlineexplicit
77  : Base(allocator)
78  {
79  }

◆ sorted_vector() [2/2]

template<typename TKey, typename TValue, class TCompare = std::less<TKey>, class TAllocator = std::allocator, class TStorage = std::standard_vector_storage<pair<TKey, TValue>, TAllocator>>
template<class InputIterator >
std::sorted_vector< TKey, TValue, TCompare, TAllocator, TStorage >::sorted_vector ( InputIterator  first,
InputIterator  last,
const allocator_type allocator = allocator_type() 
)
inline
82  : Base(first, last, allocator)
83  {
84  std::quick_sort(begin(), end(), m_compare);
85  assert(invariant());
86  }
void quick_sort(T *begin, T *end, TPredicate pred)
Definition: sort.hpp:121

Dokumentation der Elementfunktionen

◆ erase() [1/2]

template<typename TKey, typename TValue, class TCompare = std::less<TKey>, class TAllocator = std::allocator, class TStorage = std::standard_vector_storage<pair<TKey, TValue>, TAllocator>>
iterator std::sorted_vector< TKey, TValue, TCompare, TAllocator, TStorage >::erase ( iterator  it)
inline
134  {
135  assert(invariant());
136  return Base::erase(it);
137  }
iterator erase(iterator it)
Definition: vector.hpp:386

◆ erase() [2/2]

template<typename TKey, typename TValue, class TCompare = std::less<TKey>, class TAllocator = std::allocator, class TStorage = std::standard_vector_storage<pair<TKey, TValue>, TAllocator>>
size_type std::sorted_vector< TKey, TValue, TCompare, TAllocator, TStorage >::erase ( const key_type k)
inline
139  {
140  iterator i(find(k));
141  if (i == end())
142  return 0;
143  erase(i);
144  assert(invariant());
145  return 1;
146  }
iterator erase(iterator it)
Definition: sorted_vector.hpp:133
Base::iterator iterator
Definition: sorted_vector.hpp:72
iterator find(const key_type &k)
Definition: sorted_vector.hpp:112

◆ find() [1/2]

template<typename TKey, typename TValue, class TCompare = std::less<TKey>, class TAllocator = std::allocator, class TStorage = std::standard_vector_storage<pair<TKey, TValue>, TAllocator>>
iterator std::sorted_vector< TKey, TValue, TCompare, TAllocator, TStorage >::find ( const key_type k)
inline
113  {
114  assert(invariant());
115  iterator i(lower_bound(k));
116  if (i != end() && m_compare(k, *i))
117  {
118  i = end();
119  }
120  return i;
121  }
Base::iterator iterator
Definition: sorted_vector.hpp:72
iterator lower_bound(const key_type &k)
Definition: sorted_vector.hpp:152

◆ find() [2/2]

template<typename TKey, typename TValue, class TCompare = std::less<TKey>, class TAllocator = std::allocator, class TStorage = std::standard_vector_storage<pair<TKey, TValue>, TAllocator>>
const_iterator std::sorted_vector< TKey, TValue, TCompare, TAllocator, TStorage >::find ( const key_type k) const
inline
123  {
124  assert(invariant());
126  if (i != end() && m_compare(k, *i))
127  {
128  i = end();
129  }
130  return i;
131  }
Base::const_iterator const_iterator
Definition: sorted_vector.hpp:73
iterator lower_bound(const key_type &k)
Definition: sorted_vector.hpp:152

◆ insert() [1/2]

template<typename TKey, typename TValue, class TCompare = std::less<TKey>, class TAllocator = std::allocator, class TStorage = std::standard_vector_storage<pair<TKey, TValue>, TAllocator>>
pair<iterator, bool> std::sorted_vector< TKey, TValue, TCompare, TAllocator, TStorage >::insert ( const value_type val)
inline
94  {
95  assert(invariant());
96  bool found(true);
97  iterator it = lower_bound(val.first);
98  assert(it == end() || !m_compare(*it, val));
99  if (it == end() || m_compare(*it, val))
100  {
101  it = Base::insert(it, val);
102  found = false;
103  }
104  assert(invariant());
105  return pair<iterator, bool>(it, !found);
106  }
Base::iterator iterator
Definition: sorted_vector.hpp:72
void insert(size_type index, size_type n, const pair< TKey, TValue > &val)
Definition: vector.hpp:307
iterator lower_bound(const key_type &k)
Definition: sorted_vector.hpp:152

◆ insert() [2/2]

template<typename TKey, typename TValue, class TCompare = std::less<TKey>, class TAllocator = std::allocator, class TStorage = std::standard_vector_storage<pair<TKey, TValue>, TAllocator>>
pair<iterator, bool> std::sorted_vector< TKey, TValue, TCompare, TAllocator, TStorage >::insert ( const key_type k,
const mapped_type v 
)
inline
108  {
109  return insert(value_type(k, v));
110  }
pair< iterator, bool > insert(const value_type &val)
Definition: sorted_vector.hpp:93
Base::value_type value_type
Definition: sorted_vector.hpp:71

◆ lower_bound() [1/2]

template<typename TKey, typename TValue, class TCompare = std::less<TKey>, class TAllocator = std::allocator, class TStorage = std::standard_vector_storage<pair<TKey, TValue>, TAllocator>>
iterator std::sorted_vector< TKey, TValue, TCompare, TAllocator, TStorage >::lower_bound ( const key_type k)
inline
153  {
154  return std::lower_bound(begin(), end(), k, m_compare);
155  }
TIter lower_bound(TIter first, TIter last, const T &val, const TPred &pred)
Definition: algorithm.hpp:119

◆ lower_bound() [2/2]

template<typename TKey, typename TValue, class TCompare = std::less<TKey>, class TAllocator = std::allocator, class TStorage = std::standard_vector_storage<pair<TKey, TValue>, TAllocator>>
const_iterator std::sorted_vector< TKey, TValue, TCompare, TAllocator, TStorage >::lower_bound ( const key_type k) const
inline
157  {
158  return std::lower_bound(begin(), end(), k, m_compare);
159  }
TIter lower_bound(TIter first, TIter last, const T &val, const TPred &pred)
Definition: algorithm.hpp:119

◆ upper_bound() [1/2]

template<typename TKey, typename TValue, class TCompare = std::less<TKey>, class TAllocator = std::allocator, class TStorage = std::standard_vector_storage<pair<TKey, TValue>, TAllocator>>
iterator std::sorted_vector< TKey, TValue, TCompare, TAllocator, TStorage >::upper_bound ( const key_type k)
inline
161  {
162  return std::upper_bound(begin(), end(), k, m_compare);
163  }
TIter upper_bound(TIter first, TIter last, const T &val, const TPred &pred)
Definition: algorithm.hpp:136

◆ upper_bound() [2/2]

template<typename TKey, typename TValue, class TCompare = std::less<TKey>, class TAllocator = std::allocator, class TStorage = std::standard_vector_storage<pair<TKey, TValue>, TAllocator>>
const_iterator std::sorted_vector< TKey, TValue, TCompare, TAllocator, TStorage >::upper_bound ( const key_type k) const
inline
165  {
166  return std::upper_bound(begin(), end(), k, m_compare);
167  }
TIter upper_bound(TIter first, TIter last, const T &val, const TPred &pred)
Definition: algorithm.hpp:136

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