⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_60850.htm

📁 vc
💻 HTM
字号:
<p>
序号:60850 发表者:门前池塘里的鱼 发表日期:2003-11-15 22:34:42
<br>主题:怎么在集合类CTypedPtrList中删除其中的某些对象
<br>内容:POSITION m_TreeListPosition = m_TreeList-&gt;GetHeadPosition();<BR>//m_TreeList为CTypedPtrList&lt;TreeTypeList, Tree*&gt; TreeList;<BR>do<BR>{<BR>&nbsp;&nbsp;Tree * Temp_Tree = m_TreeList-&gt;GetAt(m_TreeListPosition);<BR>//<BR>&nbsp;&nbsp;m_TreeList-&gt;GetNext(m_TreeListPosition);<BR>&nbsp;&nbsp;if(Temp_Tree-&gt;State == false)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_TreeList-&gt;RemoveAt(m_TreeListPosition);<BR>&nbsp;&nbsp;&nbsp;&nbsp;delete Temp_Tree;<BR>&nbsp;&nbsp; }<BR>}<BR>while((m_TreeListPosition == 0) );<BR>帮俺看看吧,谢谢啦!
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:红苹果 回复日期:2003-11-16 00:58:26
<br>内容:如下44:<BR>POSITION pos,m_TreeListPosition = m_TreeList-&gt;GetHeadPosition();<BR>//m_TreeList为CTypedPtrList&lt;TreeTypeList, Tree*&gt; TreeList;<BR>while( pos = m_TreeListPosition )<BR>{<BR>&nbsp;&nbsp;Tree * Temp_Tree = m_TreeList-&gt;GetNext(m_TreeListPosition);<BR>&nbsp;&nbsp;if(Temp_Tree-&gt;State == false)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_TreeList-&gt;RemoveAt(pos);<BR>&nbsp;&nbsp;&nbsp;&nbsp;delete Temp_Tree;<BR>&nbsp;&nbsp; }<BR>}<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:门前池塘里的鱼 回复日期:2003-11-16 09:32:14
<br>内容:谢谢红苹果的帮忙,我还是不太明白,<BR>这个m_TreeList有三个对象的地址分别是0x00432654,0x00432660,0x43266c,可当把第二个对象删除后,执行了m_TreeList-&gt;GetNext(m_TreeListPosition)之后,指针就指向了一个陌生的地址,0x00432678,并不是0x43266c,不知道为什么?<BR>2003-11-16 9:33:04

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -