求助,CArray的Serialize()问题

felixx 2001-12-21 11:59:43
MFC中的CArray类的定义里并没有发现DECLARE_SERIAL(CArray),为什么它又是支持Serial的?
难道因为它是模版类?请大虾出手
定义如下:
template<class TYPE, class ARG_TYPE>
class CArray : public CObject
{
public:
// Construction
CArray();

// Attributes
int GetSize() const;
int GetUpperBound() const;
void SetSize(int nNewSize, int nGrowBy = -1);

// Operations
// Clean up
void FreeExtra();
void RemoveAll();

// Accessing elements
TYPE GetAt(int nIndex) const;
void SetAt(int nIndex, ARG_TYPE newElement);
TYPE& ElementAt(int nIndex);

// Direct Access to the element data (may return NULL)
const TYPE* GetData() const;
TYPE* GetData();

// Potentially growing the array
void SetAtGrow(int nIndex, ARG_TYPE newElement);
int Add(ARG_TYPE newElement);
int Append(const CArray& src);
void Copy(const CArray& src);

// overloaded operator helpers
TYPE operator[](int nIndex) const;
TYPE& operator[](int nIndex);

// Operations that move elements around
void InsertAt(int nIndex, ARG_TYPE newElement, int nCount = 1);
void RemoveAt(int nIndex, int nCount = 1);
void InsertAt(int nStartIndex, CArray* pNewArray);

// Implementation
protected:
TYPE* m_pData; // the actual array of data
int m_nSize; // # of elements (upperBound - 1)
int m_nMaxSize; // max allocated
int m_nGrowBy; // grow amount

public:
~CArray();
void Serialize(CArchive&);
#ifdef _DEBUG
void Dump(CDumpContext&) const;
void AssertValid() const;
#endif
};
...全文
92 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
felixx 2001-12-22
  • 打赏
  • 举报
回复
没人救急,我只好自己努力,还真找到答案了。
在《MFC深入浅出》的第351页的注释1当中。

69,380

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧