CList 作参数怎么定义?
void Test(CList *pList)
{
....
}
编译错误:
error C2955: 'CList' :
use of class template requires template argument list
问题点数:100、回复次数:5Top
1 楼oyf888(欧阳锋)回复于 2002-03-14 16:54:45 得分 60
用void Test(CList & myList)试一下,不传指针传引用Top
2 楼cqa()回复于 2002-03-14 16:57:10 得分 0
不行!一样的。Top
3 楼ATField()回复于 2002-03-14 17:19:37 得分 40
一定要具体点才行吧, CList<TYPE1,type2> myList
CList is a template class that takes two template arguments.
The first argument is type stored internally by the list, the
second argument is the type used in the arguments for the
CList methods
具体可参看MSDN及MFC例子COLLECT.Top
4 楼cqa()回复于 2002-03-14 17:30:08 得分 0
已经OK!
typedef CList <CTest,CTest&> CLIST;
void Test(CLIST *pList)
{
...
}Top
5 楼cqa()回复于 2002-03-14 17:31:09 得分 0
多谢 oyf888(欧阳锋) 和 ATField(field) 。
结账!Top




