我正在尝试将容器写为
template <typename T, typename A = std::allocator<T> >
class circular_dlist{
....
public:
class iterator{
....
};
void insert(T& val);
};
在我将insert()方法定义为:
时的.cpp文件中template <typename T, typename A = std::allocator<T> >
void circular_dlist<T, A>::insert(T& val){
}
我收到以下错误:
error: default template arguments may not be used in function templates without -std=c++11 or -std=gnu++11
如果我不使用c ++ 11,在这种情况下定义类定义之外的函数的正确语法是什么?
答案 0 :(得分:0)
简单地写
template <typename T, typename A>
void circular_dlist<T, A>::insert(T& val){
}