73 template <
class K,
class T>
85 template<
class K,
class T>
127 while (tmp == y->
right) {
143 }
else if (tmp->
left != 0) {
150 while (tmp == y->
left) {
184 template<
class K,
class T>
225 while (tmp == y->
right) {
241 }
else if (tmp->
left != 0) {
248 while (tmp == y->
left) {
310 template <
class Key,
class T>
329 header->left = header->right = header;
336 header->left = header->right = header;
339 header->parent->parent = header;
340 header->left = header->parent->minimum();
341 header->right = header->parent->maximum();
349 NodePtr
n =
new Node( *p );
367 clear( (NodePtr)(header->parent) );
370 header->left = header->right = header;
383 Iterator
begin() {
return Iterator( (NodePtr)(header->left ) ); }
384 Iterator
end() {
return Iterator( header ); }
385 ConstIterator
begin()
const {
return ConstIterator( (NodePtr)(header->left ) ); }
386 ConstIterator
end()
const {
return ConstIterator( header ); }
388 ConstIterator
find(
const Key&
k)
const {
394 if ( !(
key(x) < k ) ) {
404 if ( y == header || k <
key(y) )
405 return ConstIterator( header );
406 return ConstIterator( (NodePtr)y );
409 void remove( Iterator it ) {
410 NodePtr del = (
NodePtr) removeAndRebalance( it.node, header->parent, header->left, header->right );
420 inorder(
x->left,
level + 1 );
423 inorder(
x->right,
level + 1 );
434 return insert(x, y, v);
443 result = ( k <
key(x) );
448 Iterator j( (NodePtr)y );
451 if ( j ==
begin() ) {
452 return insert(x, y, k );
459 if ( (j.
node->key) < k )
460 return insert(x, y, k );
466 NodePtr
z =
new Node( k );
467 if (y == header || x != 0 || k <
key(y) ) {
472 }
else if ( y == header->
left )
476 if ( y == header->
right )
482 rebalance( z, header->
parent );
500 template<
class Key,
class T>
517 ~QMap() {
if ( sh->deref() )
delete sh; }
520 { m.
sh->
ref();
if ( sh->deref() )
delete sh; sh = m.
sh;
return *
this; }
522 Iterator
begin() { detach();
return sh->begin(); }
523 Iterator
end() { detach();
return sh->end(); }
524 ConstIterator
begin()
const {
return ((
const Priv*)sh)->begin(); }
525 ConstIterator
end()
const {
return ((
const Priv*)sh)->end(); }
528 { detach();
return Iterator( sh->find( k ).node ); }
529 ConstIterator
find (
const Key&
k )
const 530 {
return sh->find( k ); }
531 T& operator[] (
const Key&
k ) {
533 if ( p != sh->end().node )
return p->
data;
534 return insert( k,
T() ).
data(); }
535 const T& operator[] (
const Key&
k )
const 536 {
return sh->find( k ).data(); }
538 {
return find( k ) !=
end(); }
543 bool isEmpty()
const {
return sh->node_count == 0; }
547 Iterator it = sh->insertSingle( key );
552 void remove( Iterator it ) { detach(); sh->remove( it ); }
553 void remove(
const Key&
k ) {
555 Iterator it( sh->find(
k ).node );
562 return insert( k, v );
567 #if defined(Q_FULL_TEMPLATE_INSTANTIATION) 581 #ifndef QT_NO_DATASTREAM 582 template<
class Key,
class T>
596 template<
class Key,
class T>
597 inline QDataStream& operator<<( QDataStream& s, const QMap<Key,T>&
m ) {
600 for( ; it !=
m.end(); ++it )
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
QMapConstIterator< K, T > operator--(int)
const T & operator*() const
QMapPrivate(const QMapPrivate< Key, T > *_map)
bool operator!=(const QMapConstIterator< K, T > &it) const
QMapIterator< Key, T > Iterator
QMapIterator(QMapNode< K, T > *p)
ConstIterator begin() const
QMapConstIterator< K, T > & operator++()
ConstIterator end() const
Iterator replace(const Key &k, const T &v)
QMapNode(const K &_key, const T &_data)
QMapIterator< K, T > operator++(int)
QMapIterator< Key, T > Iterator
bool operator==(const QMapConstIterator< K, T > &it) const
QMapIterator< K, T > & operator++()
QMapPrivate< Key, T > Priv
QMapConstIterator< K, T > operator++(int)
QMapConstIterator(QMapNode< K, T > *p)
QMapConstIterator(const QMapIterator< K, T > &it)
QMapNode< K, T > * NodePtr
ConstIterator begin() const
bool contains(const Key &k) const
Iterator insert(const Key &key, const T &value)
ConstIterator find(const Key &k) const
ConstIterator find(const Key &k) const
QMapConstIterator< Key, T > ConstIterator
QMapConstIterator< Key, T > ConstIterator
Iterator insert(QMapNodeBase *x, QMapNodeBase *y, const Key &k)
const T & operator*() const
QMapNode(const QMapNode< K, T > &_n)
Iterator find(const Key &k)
QTextStream & dec(QTextStream &s)
QMapConstIterator(const QMapConstIterator< K, T > &it)
const Key & key(QMapNodeBase *b) const
Iterator insertMulti(const Key &v)
QMapIterator(const QMapIterator< K, T > &it)
QMap(const QMap< Key, T > &m)
QMapConstIterator< K, T > & operator--()
The QShared struct is internally used for implementing shared classes.
vector< vector< double > > clear
The QDataStream class provides serialization of binary data to a QIODevice.
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
QMapIterator< K, T > & operator--()
ConstIterator end() const
Iterator insertSingle(const Key &k)
QDataStream & operator>>(QDataStream &s, QMap< Key, T > &m)
QMapNode< Key, T > * NodePtr
QMapPrivateBase(const QMapPrivateBase *_map)
QMapIterator< K, T > operator--(int)
bool operator!=(const QMapIterator< K, T > &it) const
QMapNode< K, T > * NodePtr
bool operator==(ModuleKeyAndType const &a, ModuleKeyAndType const &b) noexcept
bool operator==(const QMapIterator< K, T > &it) const