Chinaunix首页 | 论坛 | 博客
  • 博客访问: 263429
  • 博文数量: 45
  • 博客积分: 1618
  • 博客等级: 上尉
  • 技术积分: 530
  • 用 户 组: 普通用户
  • 注册时间: 2010-09-11 10:13
文章分类

全部博文(45)

文章存档

2012年(1)

2011年(25)

2010年(19)

我的朋友

分类: C/C++

2010-09-27 20:59:46

msdn介绍:支持CString对象的数组,应用类似于CObArray类,所有类似的类如下

CByteArray

CByteArray( );

CDWordArray

CDWordArray( );

CPtrArray

CPtrArray( );

CStringArray

CStringArray( );

CUIntArray

CUIntArray( );

CWordArray

CWordArray( );

构造方式

CObArray arr; //Array with default blocksize
CObArray* pArray = new CObArray;


大体通用函数:

GetCount
  获取数组中所有元素个数
 
GetSize
  同上吧
 
GetUpperBound
 Returns the largest valid index.
 
SetSize
 Sets the number of elements to be contained in this array.
 
FreeExtra
 Frees all unused memory above the current upper bound.
 
RemoveAll
  清空整个数组
 
ElementAt
  返回对象的引用,即直接操纵对象,不会出错
 
GetAt
  返回索引值的对象,注意它会进行默认的copy,所以要重载"=",如果没有就是执行缺省的
 
GetData
 Allows access to elements in the array. Can be NULL.
 
SetAt
 Sets the value for a given index; array not allowed to grow.
 
Add
  在数组的末尾添加一个元素,如果有必要它会自动增长
 
Append
 Appends another array to the array; grows the array if necessary.
 
Copy
 Copies anolther array to the array; grows the array if necessary.
 
SetAtGrow
 Sets the value for a given index; grows the array if necessary.
 
InsertAt
 Inserts an element (or all the elements in another array) at a specified index.
 
IsEmpty
  测试数组是否为空
 
RemoveAt
 Removes an element at a specific index.
 

msdn上有太详细的介绍了,再说就是废话了!不过要注意ElementAtGetAt的区别
阅读(2049) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~