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

推荐订阅源

Google DeepMind News
Google DeepMind News
爱范儿
爱范儿
J
Java Code Geeks
L
LangChain Blog
V
V2EX
大猫的无限游戏
大猫的无限游戏
S
SegmentFault 最新的问题
博客园 - Franky
Microsoft Azure Blog
Microsoft Azure Blog
Jina AI
Jina AI
Blog — PlanetScale
Blog — PlanetScale
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The Cloudflare Blog
博客园 - 司徒正美
B
Blog
G
Google Developers Blog
Stack Overflow Blog
Stack Overflow Blog
罗磊的独立博客
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Apple Machine Learning Research
Apple Machine Learning Research
Engineering at Meta
Engineering at Meta
MyScale Blog
MyScale Blog
有赞技术团队
有赞技术团队
Hugging Face - Blog
Hugging Face - Blog

博客园 - 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);