模板高手请进,急问!
template <class Item>
class ListIterator
{
typedef std::list<Item> Listtype;
public:
ListIterator(const Listtype * aList){
alist = aList;
pos = aList->begin();
}
virtual ~ListIterator();
private:
Listtype * alist;
Listtype::iterator pos;
};
无法编译通过,什么原因?
linux中,错误信息如下:
In function `__default_alloc_template<true, 0>::_S_chunk_alloc(unsigned int, int &)':
/usr/include/g++-3/stl_alloc.h:480: undefined reference to `ListIterator<char *>::ListIterator(list<char *, allocator<char *> > const *)'
/usr/include/g++-3/stl_alloc.h:488: undefined reference to `ListIterator<char *>::~ListIterator(void)'
/usr/include/g++-3/stl_alloc.h:501: undefined reference to `ListIterator<char *>::~ListIterator(void)'
collect2: ld returned 1 exit status
我大概知道是没有正确的allocator,有没有高手给个例子之类?