本文整理汇总了C++中LList::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ LList::remove方法的具体用法?C++ LList::remove怎么用?C++ LList::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LList
的用法示例。
在下文中一共展示了LList::remove方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc,char** argv)
{
LList* l = new LList();
l->add(1)->p()->add(2)->p()->add(4)->p()->add(10)->p()->add(80)->p();
l->reverse()->p();
l->remove(44)->p()->remove(2)->p()->remove(10)->p()->remove(80)->p()->remove(1)->p()->remove(4)->p()->remove(99)->p();
StackL* s = new StackL();
s->push(1)->p()->push(2)->p()->push(5)->p()->push(3)->p();
s->pop();
s->p();
s->pop();
s->p();
s->pop();
s->p();
s->pop();
s->p();
QueueL* q = new QueueL();
q->enq(1)->p()->enq(2)->p()->enq(5)->p();
q->dq()->p()->dq()->p()->dq()->p();
return 0;
}
示例2: TestLList
int TestLList()
{
LList<char *> *llist = new LList<char *>();
TEST_ASSERT(llist);
TEST_ASSERT(!llist->valid((unsigned int)-1));
TEST_ASSERT(!llist->valid(1));
TEST_ASSERT(!llist->valid(0));
llist->insert(newStr("one"));
llist->insert(newStr("two"));
llist->insert(newStr("three"));
llist->insert(newStr("four"));
TEST_ASSERT(strcmp(llist->get(0), "one") == 0);
TEST_ASSERT(strcmp(llist->get(2), "three") == 0);
TEST_ASSERT(strcmp(llist->get(3), "four") == 0);
TEST_ASSERT(strcmp(llist->get(1), "two") == 0);
delete [] llist->get(1);
llist->remove(1);
TEST_ASSERT(strcmp(llist->get(0), "one") == 0);
TEST_ASSERT(strcmp(llist->get(1), "three") == 0);
TEST_ASSERT(strcmp(llist->get(2), "four") == 0);
while (llist->valid(0)) {
delete [] llist->get(0);
llist->remove(0);
}
TEST_ASSERT(!llist->valid((unsigned int)-1));
TEST_ASSERT(!llist->valid(1));
TEST_ASSERT(!llist->valid(0));
delete llist;
return 0;
}