CList
声明原型:template< class TYPE, class ARG_TYPE > class CList : public CObject
ARG_KEY类型,是为了在CList方法调用的时候,使用引用而非传值。
实例:
CMap::RemoveKey
BOOL RemoveKey( ARG_KEY key );
插值实例:
CList<CString, CString&> MyListStr;
MyListStr.AddTail(CString("XYZ"));
MyListStr.AddTail(CString("ABC"));
MyListStr.AddTail(CString("123"));
取值实例:
// Dump the list elements to the debug window.
POSITION pos = MyListStr.GetHeadPosition();
for (int i = 0; i < MyListStr.GetCount(); i++)
{
TRACE("%s\r\n", (LPCSTR)MyListStr.GetNext(pos));
}