在 c++ 中使用 CList -无法理解

发布于 2024-11-03 17:48:52 字数 374 浏览 0 评论 0原文

我搜索了一个使用 CList 的示例程序。但我找不到它。我得到了一些关于 CList 的基本定义(行为类似于双向链表的模板类)..并用于存储聚合数据..第一个参数由列表内部存储。.我看不到列表中存储了哪些元素以及如何检索它。

RsData Data; //object of class RsData
RsEvent* Event;//pointer to class RsEvent
CList<Event*,Event*>  EventQueue;
Data.EventQueue.RemoveAll(); 
//removing the attributes and methods of the class RsEvent stored in the list.

I searched for a sample program to work on with the CList.But i could not find it.I got some basic definitions about the CLists(template class that behaves similar to the doubly linked lists).. and is used to store the aggregate data..The 1st argument is stored internally by the list..I could not see what elements are stored in the list and how to retrieve it.

RsData Data; //object of class RsData
RsEvent* Event;//pointer to class RsEvent
CList<Event*,Event*>  EventQueue;
Data.EventQueue.RemoveAll(); 
//removing the attributes and methods of the class RsEvent stored in the list.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初心未许 2024-11-10 17:48:52

所以文档是 MSDN 上的 CList

那里有一个链接 COLLECT 示例:说明 MFC 集合类

I'我不确定如何找不到该文档,所以也许您的问题需要澄清。

该列表提供了前/后插入和查找,以及迭代方法。

// Define myList.
CList<CString,CString&> myList;

// Add an element to the front of the list.
myList.AddHead(CString("ABC"));

// Verify the element was added to the front of the list.
ASSERT(CString("ABC") == myList.GetHead());

So the doc is CList on MSDN

And there is a link there for the COLLECT Sample: Illustrates MFC Collection Classes

I'm not sure how this doc was not found, so perhaps your question needs to be clarrified.

The list offers front/back inserting and looking, aswell as methods for iterating.

// Define myList.
CList<CString,CString&> myList;

// Add an element to the front of the list.
myList.AddHead(CString("ABC"));

// Verify the element was added to the front of the list.
ASSERT(CString("ABC") == myList.GetHead());
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文