??xml version="1.0" encoding="utf-8" standalone="yes"?>սֱĺղ:C++博客 - սƵ2019|սع//www.pppqb.icu/Uthinker/the quieter you become,the more you are able to hearzh-cnMon, 16 Sep 2019 00:57:36 GMTMon, 16 Sep 2019 00:57:36 GMT60[译] CStringArray Class - սƵ2019|սع//www.pppqb.icu/Uthinker/archive/2018/12/12/216119.htmlUthinkerUthinkerWed, 12 Dec 2018 14:31:00 GMT//www.pppqb.icu/Uthinker/archive/2018/12/12/216119.html//www.pppqb.icu/Uthinker/comments/216119.html//www.pppqb.icu/Uthinker/archive/2018/12/12/216119.html#Feedback0//www.pppqb.icu/Uthinker/comments/commentRss/216119.html//www.pppqb.icu/Uthinker/services/trackbacks/216119.html当您看到CObject指针作ؓ函数参数Ӟh换LPCTSTR?/span>原文 https://docs.microsoft.com/zh-cn/previous-versions/tddz3etf(v=vs.140)

此类为支持CString对象数组?br />头文Ӟafxcoll.h
格式Q?br />
class CStringArray : public CObject  
成员
CStringArray的成员函数类gCObArraycȝ成员函数。由于类|你可以通过CObArray参考文?成员函数Ҏ。当您看到CObject指针作ؓq回值时Q请替换CString对象(而不是CString指针)。当您看到CObject指针作ؓ函数参数Ӟh换LPCTSTR?br />
CObject* CObArray::GetAt( int <nIndex> ) const;
例如Q替换ؓ
CString CStringArray::GetAt( int <nIndex> ) const;
?br />
void SetAt( int <nIndex>, CObject* <newElement> )
替换?br />
void SetAt( int <nIndex>, LPCTSTR <newElement> )

公有构造函?br />
CObArray::CObArray
构造一个空数组




ҎQ公有)
名称说明
CObArray::Add
元素添加到数组的末?如果需要增加数l?/span>
CObArray::Append
另一个数l追加到该数l?如果需要增加数l?/span>
CObArray::Copy另一个数l复制到该数l?如果需要增加数l?/span>
CObArray::ElementAtq回Ҏl中元素指针的时引?/span>
CObArray::FreeExtra释放当前上限以上的所有未使用内存
CObArray::GetAtq回l定索引处的?/span>
CObArray::GetCount获取该数l中的元素数
CObArray::GetData允许讉K数组中的元素?/span>可以为空
CObArray::GetSize获取该数l中的元素数
CObArray::GetUpperBoundq回最大的有效索引
CObArray::InsertAt在指定烦引处插入一个元?或另一个数l中的所有元?
 CObArray::IsEmpty 判断该数l是否ؓI?/span>
 CObArray::RemoveAll U除该数l所有元?/span>
 CObArray::RemoveAt U除指定位置的元?/span>
 CObArray::SetAt 讄l定索引的?数组不允许增?/span>
 CObArray::SetAtGrow 讄l定索引的?如果需要增加数l?/span>
 CObArray::SetSize讄该数l中要包含的元素的数?/span>




























备注
CStringArray合ƈ了IMPLEMENT_SERIAL宏来支持序列化和转储它的元素?/span>如果CString对象数组存储到存?文g中,要么使用重蝲插入操作W,要么使用Serialize成员函数Q则依次序列化每个元素?br />注意Q?br />在用数l之前,使用SetSize定其大ƈ为其分配内存?/span>如果不用SetSizeQ则向数l中d元素会经帔R新分配和复制它?/span>频繁的重新分配和复制是低效的Qƈ且会片化内存?/span>


Uthinker 2018-12-12 22:31 发表评论
]]>
C++学习W记 - սƵ2019|սع//www.pppqb.icu/Uthinker/archive/2018/02/09/215511.htmlUthinkerUthinkerFri, 09 Feb 2018 09:09:00 GMT//www.pppqb.icu/Uthinker/archive/2018/02/09/215511.html//www.pppqb.icu/Uthinker/comments/215511.html//www.pppqb.icu/Uthinker/archive/2018/02/09/215511.html#Feedback0//www.pppqb.icu/Uthinker/comments/commentRss/215511.html//www.pppqb.icu/Uthinker/services/trackbacks/215511.html

Uthinker 2018-02-09 17:09 发表评论
]]>
C++学习W记之初?/title><link>//www.pppqb.icu/Uthinker/archive/2017/11/06/215329.html</link><dc:creator>Uthinker</dc:creator><author>Uthinker</author><pubDate>Mon, 06 Nov 2017 07:11:00 GMT</pubDate><guid>//www.pppqb.icu/Uthinker/archive/2017/11/06/215329.html</guid><wfw:comment>//www.pppqb.icu/Uthinker/comments/215329.html</wfw:comment><comments>//www.pppqb.icu/Uthinker/archive/2017/11/06/215329.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>//www.pppqb.icu/Uthinker/comments/commentRss/215329.html</wfw:commentRss><trackback:ping>//www.pppqb.icu/Uthinker/services/trackbacks/215329.html</trackback:ping><description><![CDATA[//Ving<img src ="//www.pppqb.icu/Uthinker/aggbug/215329.html" width = "1" height = "1" /><br><br><div align=right><a href="//www.pppqb.icu/" title="սƵ2019">սƵ2019</a> 2017-11-06 15:11 <a href="//www.pppqb.icu/Uthinker/archive/2017/11/06/215329.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <script>(function(){ var src = (document.location.protocol == "") ? "//js.passport.qihucdn.com/11.0.1.js?9ed1f3a8f9c3ff069b7b95c01474c743":"https://jspassport.ssl.qhimg.com/11.0.1.js?9ed1f3a8f9c3ff069b7b95c01474c743"; document.write('<script src="' + src + '" id="sozz"><\/script>'); })(); </script>