网站首页  计算机词典

请输入您要查询的字词:

 

字词 CObList::InsertBefore
释义 CObList::InsertBefore

POSITION InsertBefore( POSITION position, CObject* newElement );
  throw( CMemoryException );

返回值:
可用于迭代或对象指针检索的 POSITION 值。若列表为空,则返回NULL 。

参数:
position由前面调用的GetNext, GetPrev或Find等成员函数返回的POSITION值。
newElement指向要添加到该列表的对象指针。

说明:
在指定位置的元素前添加一个元素到列表中。

示例:
CObList list;
POSITION pos1, pos2;
list.AddHead( new CAge( 21 ) );
list.AddHead( new CAge( 40 ) ); // List now contains (40, 21).
if( ( pos1 = list.GetTailPosition() ) != NULL )
{
  pos2 = list.InsertBefore( pos1, new CAge( 65 ) );
}
#ifdef _DEBUG
   afxDump.SetDepth( 1 );
   afxDump << "InsertBefore example: " << &list << "\";
#endif

该程序的结果如下:
InsertBefore example: A CObList with 3 elements
a CAge at $4AE2 40
a CAge at $4B02 65
a CAge at $49E6 21

请参阅:CObList::Find, CObList::InsertAfter
随便看

 

计算机英汉双解词典包含34412条计算机术语英汉翻译词条,基本涵盖了全部常用计算机术语的翻译及用法,是计算机学习及翻译工作的有利工具。

 

Copyright © 2021-2025 foosec.com All Rights Reserved
更新时间:2026/10/24 0:05:20