Qt:Документация 4.3.2/qlinkedlist-qt3

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск
40px Внимание: Актуальная версия перевода документации находится здесь

__NOTOC__

Image:qt-logo.png

Главная · Все классы · Основные классы · Классы по группам · Модули · Функции

Image:trolltech-logo.png

Содержание

[править] Qt 3 Support Members for QLinkedList

Описанные ниже члены класса являются частью слоя поддержки Qt 3. Они введены для поддержки старого кода в Qt 4. Мы советуем не использовать их во вновь создаваемом коде.



[править] Открытые функции

  • iterator find ( iterator from, const T & t )
  • iterator find ( const T & t )
  • const_iterator find ( const_iterator from, const T & t ) const
  • const_iterator find ( const T & t ) const
  • int findIndex ( const T & t ) const
  • iterator remove ( iterator pos )

[править] Описание функций-членов

[править]
iterator QLinkedList::find ( iterator from, const T & t )

If you need random access to a data structure then QList, QVector, QMap, or QHash, are all better choices than QLinkedList.

Например, если у вас есть код

 QLinkedList::iterator i = list->find(from, value);

вы можете записать его в виде

 QLinkedList::iterator i = from;
 while (i != list->end() && *i != value)
     ++i;

[править]
iterator QLinkedList::find ( const T & t )

Эта перегруженная функция предоставлена для удобства.

If you need random access to a data structure then QList, QVector, QMap, or QHash, are all better choices than QLinkedList.

Например, если у вас есть код

 QLinkedList::iterator i = list->find(value);

вы можете записать его в виде

 QLinkedList::iterator i = list->begin();
 while (i != list->end() && *i != value)
     ++i;

[править]
const_iterator QLinkedList::find ( const_iterator from, const T & t ) const

Эта перегруженная функция предоставлена для удобства.

If you need random access to a data structure then QList, QVector, QMap, or QHash, are all better choices than QLinkedList.

Например, если у вас есть код

 QLinkedList::const_iterator i = list->find(from, value);

вы можете записать его в виде

 QLinkedList::const_iterator i = from;
 while (i != list->end() && *i != value)
     ++i;

[править]
const_iterator QLinkedList::find ( const T & t ) const

Эта перегруженная функция предоставлена для удобства.

If you need random access to a data structure then QList, QVector, QMap, or QHash, are all better choices than QLinkedList.

Например, если у вас есть код

 QLinkedList::const_iterator i = list->find(value);

вы можете записать его в виде

 QLinkedList::const_iterator i = list->begin();
 while (i != list->end() && *i != value)
     ++i;

[править]
int QLinkedList::findIndex ( const T & t ) const

If you need indexes then QList or QVector are better choices than QLinkedList.

Например, если у вас есть код

 int index = list->findIndex(value);

вы можете записать его в виде

 int index = 0;
 bool found = false;
 for (const_iterator i = list->begin(); i != list->end(); ++i; ++index)
     if (*i == value) {
         found = true;
         break;
     }
 if (!found)
     index = -1;

[править]
iterator QLinkedList::remove ( iterator pos )

Use erase() instead.



Copyright © 2007 Trolltech Trademarks
Qt 4.3.2