【发布时间】:2014-02-27 16:48:46
【问题描述】:
我正在对遗留代码执行一些后台维护。
它涉及用 STL 替换已弃用的库,并在保持界面尽可能相似的同时进行提升。
ostream& operator<<(ostream& vos, const OurList<class T>& coll)
{
// OurList wraps an stl list with the same interface as the current library
// OurListIterator wraps an iterator class used to access OurList
OurListIterator<T, OurList<class T> > iter((OurList<class T>&)coll);
// this function gets the first item in the list and then each next one
while (iter())
{
// key returns the value pointed to by the iterator
vos << iter.key();
}
};
但是,当我编译它时,我在 vos
binary '
我猜编译器之所以抱怨是因为它事先不知道 T 是否可序列化?但是,这在当前库中有效 - 我错过了什么吗?
【问题讨论】:
-
尝试删除
class。
标签: c++ templates serialization