惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
WordPress大学
WordPress大学
T
Tailwind CSS Blog
V
Visual Studio Blog
月光博客
月光博客
Hugging Face - Blog
Hugging Face - Blog
小众软件
小众软件
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - Franky
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Last Week in AI
Last Week in AI
阮一峰的网络日志
阮一峰的网络日志
量子位
有赞技术团队
有赞技术团队
酷 壳 – CoolShell
酷 壳 – CoolShell
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
Jina AI
Jina AI
雷峰网
雷峰网
博客园 - 【当耐特】
博客园 - 叶小钗
美团技术团队
宝玉的分享
宝玉的分享
IT之家
IT之家

博客园 - avisnet

枚举浏览器窗口 关闭弹出式IE浏览器窗口编程 iframe自适应高度 - avisnet - 博客园 FormView 在对话框里面使用ON_UPDATE_COMMAND_UI映射工具条 automation服务器不能创建对象 汇率 无题 [转]猪的爱情故事 在新窗口中打开网页,同时关闭原有窗口 删除文件至回收站而不是永久删除 低层键盘钩子 C++编译器默认声明的成员函数 使用SqlServer模式的会话状态管理 Session Data Is Lost When You Use ASP.NET InProc Session State Mode [转]LINK : warning LNK4089: all references to "xxx.dll" discarded by /OPT:REF VC++中消除警告 const与typedef的中高级使用 在 ASP.NET 中执行 URL 重写
实现集合类的帮助函数
avisnet · 2006-10-13 · via 博客园 - avisnet

集合类的帮助函数:

CompareElements

Indicates whether elements are the same.

CopyElements

Copies elements from one array to another.

DumpElements

Provides stream-oriented diagnostic output.

HashKey

Calculates a hash key.

SerializeElements

Stores or retrieves elements to or from an archive.


使用下面的方法实现CompareElements时,不知道为何CompareElements不会被执行:
template<>
BOOL AFXAPI CompareElements(const CTextBoxButton* pElement1, const CTextBoxButton* pElement2)
{
 ENSURE(pElement1 != NULL && pElement2 != NULL);

 

return pElement1->GetID() == pElement2->GetID();
}

需要将CTextBoxButton*类型重新定义:

typedef CTextBoxButton* PCTextBoxButton;

template<>
BOOL AFXAPI CompareElements(const PCTextBoxButton* pElement1, const PCTextBoxButton* pElement2)
{
 ENSURE(pElement1 != NULL && pElement2 != NULL);

 

return (*pElement1)->GetID() == (*pElement2)->GetID();
}

CTextBoxButton btn;
btn.SetID(10);
CList<CTextBoxButton*, CTextBoxButton*>   m_lstButton.
POSITION pos = m_lstButton.Find(&btn);