CArray属于MFC,是一个数组模板类。MFC的数组类支持的数组类似于常规数组,可以存放任何数据类型。常规数组在使用前必须将其定义成能够容纳所有可能需要的元素,即先确定大小,而MFC数组类创建的对象可以根据需要动态地增大或减小,数组的起始下标是0,而上限可以是固定的,也可以随着元素的增加而增加,数组在内存中的地址仍然是连续分配的。但是声明一个carray数组必须是确定数组长度,可以之后随元素增加而增加。
使用CArray要添加一个头文件#include <afxtempl.h>
基本函数:
CArray::GetSize
int GetSize( ) const;取得当前数组元素个数.
CArray::GetUpperBound
int GetUpperBound( ) const;最得最大的元素的索引,由于C的数组是从0开始,所以此函数的返回值比GetSize的返回值比 小.
CArray::SetSize
void SetSize( int nNewSize, int nGrowBy = -1 );throw( CMemoryException );
设置数组的大小.
CArray::FreeExtra
void FreeExtra( );释放未使用的空间.
CArray::RemoveAll
void RemoveAll( );删除所有的元素.
CArray::GetAt
TYPE GetAt( int nIndex ) const;
根据索引(参数)取得某个数组元素的值.
根据索引(参数)取得某个数组元素的值.
CArray::SetAt
void SetAt( int nIndex, ARG_TYPE newElement );将第nIndex的元素的值设置成newElement.
CArray::ElementAt
TYPE& ElementAt( int nIndex );取得第nIndex个元素的引用.
CArray::GetData
const TYPE* GetData( ) const;TYPE* GetData( );
取得静态数组指针.
void SetAtGrow( int nIndex, ARG_TYPE newElement );
throw( CMemoryException );将第nIndex个元素设置成newElement,如果数组元素不够,会增加空间.
CArray::Add
int Add( ARG_TYPE newElement );throw( CMemoryException );
增加一个元素.
CArray::Append
int Append( const CArray& src );将另一个数组追加过来.
void Copy( const CArray& src );
复制数组,已经内容将会被覆盖.CArray::InsertAt
void InsertAt( int nIndex, ARG_TYPE newElement, int nCount = 1 );throw( CMemoryException );
void InsertAt( int nStartIndex, CArray* pNewArray );
throw( CMemoryException );
插入一个元素(或另一个数组)到数组.
CArray::RemoveAt
void RemoveAt( int nIndex, int nCount = 1 );删除另一个元素.
CArray::operator [ ]
TYPE& operator []( int nIndex );TYPE operator []( int nIndex ) const;
通过索引设置或取得另一个元素.
ubuntu14.0安装ITK的步骤
Ubuntu服务器上相关软件或应用时常打不开的问题
机器学习之训练集_验证集_测试集
VS C++ 并发编程
Matlab保存uint16格式文件的相关注意事项
OpenCV中的SVM参数优化
caffe之solver.prototxt文件参数设置
FY21 Microsoft Inspire Online Sessions Journey Guidance
Azure Function Runtime版本和IP输出格式问题
- 最新文章
-
模型压缩(1)
模型压缩(0)
Deep Breath
TensorFlow实战—Google Inception Net
TensorFlow实战—ResNet
论文阅读笔记U-net:Convolutional Networks for Biomedical Image Segmentation
TensorFlow实战-VGGNet
vim, sublimetext http://www.sublimetext.cn/
$ sudo apt-get install firefox
pad image to 512x512
- 热门文章
-
git push a file which is larger than 5MB
nomachine
samba server
Find all the softlinks under folder "data"
install xshell,xftp <You can't access this shared folder because your organization's security policies block unauthenticated guest access. These policies help protect your PC from >
GPG error: http://mirrors.cloud.aliyuncs.com/ubuntu xenial-backports InRelease
X window driver 450
Caffe训练AlexNet网络模型——问题三
主动学习(Active Learning)
主动学习——active learning