【发布时间】:2015-05-23 17:37:25
【问题描述】:
我有一个带有这样模板的类:
template <template <class, class> class ContainerType>
我在私有字段中设置了一些全局函数和静态..
我在类之外实现了我的这些功能,并且在我声明模板的任何功能之前
template <template <class, class> class ContainerType>
但是有了这样的功能,我得到了这个错误:
错误:“
template<template<class, class> class ContainerType>
void Book<ContainerType>::listCopier(const List_to_copy<ContainerType>& that)
{
if(mylist.begin() != mylist.end())
std::for_each(mylist.begin(), mylist.end(), DeleteLIST());
_this = this;
std::for_each(that.mylist.begin(), that.mylist.end(), myAllocator);
}
它可能是什么以及我如何解决它!?
【问题讨论】:
-
阅读有关模板的章节将是一个好的开始
-
需要这样嵌套吗?
-
我读过!但我不知道是什么导致了这个问题...
-
@מג'דשרקייה 请发布最小代码 sn-p,我们可以尝试编译并重现该问题。你上面的内容是无效的。它不声明或定义类/函数。您的 sn-p 是声明的一部分。看看here 一个有效的例子。
-
@polarysekt:你什么意思!?
标签: c++