问题描述
创建列表时:
list< class A *> l;
如何删除指针包含在l中的所有对象?
感谢您的评论?
When creating a list:
list<class A*> l;
How to delete all the objects whose pointers are contained in "l"?
Thanks for your comments?
推荐答案
首先遍历列表并删除每个对象。
一种方法是使用''for''循环。
然后清除列表。
-
答:因为它弄乱了人们通常阅读文本的顺序。
问:为什么顶级发布这么糟糕的事情?
A:热门发布。
问:usenet和电子邮件中最烦人的是什么?
First iterate through the list and delete each object.
One way to do that is to use a ''for'' loop.
Then clear the list.
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
首先遍历列表并删除每个对象。 />
一种方法是使用''for''循环。
然后清除列表。
First iterate through the list and delete each object.
One way to do that is to use a ''for'' loop.
Then clear the list.
谢谢! 遍历列表和删除每个指针都很明显。
你是什么意思清除列表?
Thanks! "iterate through the list" and "delete" every pointer is obvious.
What do you mean by "clear the list"?
这篇关于list< class A *>升;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!