本文整理汇总了C++中QLinkedList::prepend方法的典型用法代码示例。如果您正苦于以下问题:C++ QLinkedList::prepend方法的具体用法?C++ QLinkedList::prepend怎么用?C++ QLinkedList::prepend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLinkedList
的用法示例。
在下文中一共展示了QLinkedList::prepend方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main ()
{
QLinkedList<QString> list;
list.prepend("one");
list.prepend("two");
list.prepend("three");
assert(list.first() == "three");
// list: ["three", "two", "one"]
return 0;
}
示例2: exceptionLinkedList
void tst_ExceptionSafety::exceptionLinkedList() {
{
QLinkedList<FlexibleThrowerSmall> list;
QLinkedList<FlexibleThrowerSmall> list2;
QLinkedList<FlexibleThrowerSmall> list3;
for( int i = 0; i<10; i++ )
list.append( FlexibleThrowerSmall(i) );
try {
throwType = ThrowAtCopy;
list.append( FlexibleThrowerSmall(10));
} catch (...) {
}
QCOMPARE( list.size(), 10 );
try {
throwType = ThrowAtCopy;
list.prepend( FlexibleThrowerSmall(10));
} catch (...) {
}
QCOMPARE( list.first().value(), 0 );
QCOMPARE( list.size(), 10 );
try {
throwType = ThrowAtCopy;
list3 = list;
list3.append( FlexibleThrowerSmall(11) );
} catch (...) {
}
QCOMPARE( list.first().value(), 0 );
QCOMPARE( list.size(), 10 );
QCOMPARE( list3.size(), 10 );
}
QCOMPARE(objCounter, 0 ); // check that every object has been freed
}