# include <iostream>
using namespace std;
template <typename T>
class List
{
private:
class Node;
int size;
Node* head;
Node* tail;
public:
class iterator;
List();
List(const List&);
~List();
const List& operator =(const List&);
iterator begin() {return iterator(head->next);}
iterator end() {return iterator(tail);}
int getsize() const {return size;}
bool empty() const {return getsize()==0;}
void clear() {while (!empty()) pop_front();}
T& front() {return *begin();}
T& back() {return *--end();}
void push_front(const T&x) {insert(begin(),x);}
void push_back(const T&x) {insert(end(),x);}
void pop_front() {erase(begin());}
void pop_back() {erase(--end());}
typename iterator insert(iterator iter,T x); //return the iterator referring to the element that was added
typename iterator erase(iterator);//return the iterator referring to the element after the one deleted
typename iterator erase(iterator,iterator);//to remove the range of elements denoted by the two iterators
};
main()
{
List<int> l1;
// List<int>::iterator it1;//=l1.begin();
for(int i=0;i<=10;i++)
l1.insert(l1.end(),i);
return 0;
}
出现如下错误,大家帮帮忙啊!!
C:\Documents and Settings\eastwinter\桌面\新建文件夹\list1.cpp(170) : error C2664: 'insert' : cannot convert parameter 1 from 'class List<int>::iterator' to 'class List<int>::iterator'
Source or target has incomplete type
我头疼啊,为什么一样还说不一样啊??????/?:(
问题已经解决,但是不想把分数浪费,呵呵,谁想要分的赶快来说声啊,抓紧时间拉.
cannot convert parameter 1 from 'class List<int>::iterator' to 'class List<i
答案:2 悬赏:80 手机版
解决时间 2021-03-14 05:18
- 提问者网友:孤山下
- 2021-03-13 10:35
最佳答案
- 五星知识达人网友:街头电车
- 2021-03-13 11:09
我遇到了这样的问题error: cannot convert ‘std::vector<MyRect>::const_iterator’ to ‘const MyRect*’ for argument ‘1’ to ‘int is_equal(const MyRect*, const MyRect*)’,求帮助
全部回答
- 1楼网友:雪起风沙痕
- 2021-03-13 12:02
期待看到有用的回答!
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯