CPtrList Class

CPtrList : CObject

The CPtrList class supports lists of void pointers.

The member functions of CPtrList are similar to the member functions of class CObList. Because of this similarity, you can use the CObList reference documentation for member function specifics. Wherever you see a CObject pointer as a function parameter or return value, substitute a pointer to void.

CObject*& CObList::GetHead() const;

for example, translates to

void*& CPtrList::GetHead() const;

CPtrList incorporates the IMPLEMENT_DYNAMIC macro to support run-time type access and dumping to a CDumpContext object. If you need a dump of individual pointer list elements, you must set the depth of the dump context to 1 or greater.

Pointer lists cannot be serialized.

When a CPtrList object is deleted, or when its elements are removed, only the pointers are removed, not the entities they reference.

For more information on using CPtrList, see the articleCollections in Visual C++ Programmer’s Guide.

#include <afxcoll.h>

CPtrList Class Members

Construction

CPtrListConstructs an empty list for void pointers.
构建空指针的空列表。

Head/Tail Access

GetHeadReturns the head element of the list (cannot be empty).
返回列表的头元素(不能为空)。
GetTailReturns the tail element of the list (cannot be empty).
返回列表的尾部元素(不能为空)。

Operations

RemoveHeadRemoves the element from the head of the list.
RemoveTailRemoves the element from the tail of the list.
AddHeadAdds an element (or all the elements in another list) to the head of the list (makes a new head).
增加一个元素到表头(或其他列表中的所有元素添加到列表的头)(成为一个新的头)。
AddTailAdds an element (or all the elements in another list) to the tail of the list (makes a new tail).
增加一个元素到表尾(或其他列表中的所有元素添加到列表的头)(成为一个新的尾)。
RemoveAllRemoves all the elements from this list.

Iteration

GetHeadPositionReturns the position of the head element of the list.
返回列表的头元素的位置。
GetTailPositionReturns the position of the tail element of the list.
返回列表的尾部元素的位置。
GetNextGets the next element for iterating.
获取用于迭代的下一个元素。
GetPrevGets the previous element for iterating.
获取迭代的前一个元素。

Retrieval/Modification

GetAtGets the element at a given position.
SetAtSets the element at a given position.
RemoveAtRemoves an element from this list, specified by position.

Insertion

InsertBeforeInserts a new element before a given position.
InsertAfterInserts a new element after a given position.

Searching

FindGets the position of an element specified by pointer value.
获取由指针值指定的元素的位置。
FindIndexGets the position of an element specified by a zero-based index.

Status

GetCountReturns the number of elements in this list.
IsEmptyTests for the empty list condition (no elements).

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值