【发布时间】:2014-06-06 06:38:03
【问题描述】:
我在 MSVC afxtempl.h 和 MSDN 上查找了 CList 定义。我没有看到CList& operator=(const CList&); 被定义。
我可以像这样直接使用operator=复制一个CList对象吗?
CList<int> a = b;
或者我应该在目标 CList 上手动将源 CList 从 head 迭代到 tail 和 AddTail?
for(POSITION pos = a.HeadPosition(); pos; )
{
const auto& item = a.GetNext(pos);
b.AddTail(item);
}
任何建议都会有所帮助。 谢谢。
【问题讨论】: