我有一个恭维错误。 [英] I got one compliation error.

查看:61
本文介绍了我有一个恭维错误。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用g ++ 3.4.2编译这个程序时出现了一个compliation错误。

谁能告诉我原因?

谢谢。

#include< iostream>

使用命名空间std;


模板< class T>

class list {

类迭代器{

朋友类列表;

迭代器运算符++(){

返回* this;

}

};

};


模板< class T>

list< T> :: iterator list< T> :: iterator :: operator ++(){

return * this;

}

>
int main(){

返回0;

}

I got a compliation error when compiling this programs using g++ 3.4.2.
Who can tell me why?
Thank you.

#include<iostream>
using namespace std;

template<class T>
class list{
class iterator{
friend class list;
iterator operator++(){
return *this;
}
};
};

template<class T>
list<T>::iterator list<T>::iterator::operator++(){
return *this;
}

int main(){
return 0;
}

推荐答案

2006年3月31日20:27:46 -0800, ne ******* ****@gmail.com 写在

comp.lang.c ++:
On 31 Mar 2006 20:27:46 -0800, ne***********@gmail.com wrote in
comp.lang.c++:
我在编译这个程序时遇到了一个compliation错误g ++ 3.4.2。


错误是什么?你想让我们猜猜吗?

谁能告诉我原因?
谢谢你。

#include< iostream>
使用命名空间std;

模板< class T>
类列表{
类迭代器{
朋友类列表;
迭代器运算符++(){
返回* this ;
}
};
};

模板< class T>
list< T> :: iterator list< T> :: iterator: :operator ++(){
返回* this;
}
int main(){
返回0;
}
I got a compliation error when compiling this programs using g++ 3.4.2.
What''s the error? Do you want us to guess?
Who can tell me why?
Thank you.

#include<iostream>
using namespace std;

template<class T>
class list{
class iterator{
friend class list;
iterator operator++(){
return *this;
}
};
};

template<class T>
list<T>::iterator list<T>::iterator::operator++(){
return *this;
}

int main(){
return 0;
}



-

Jack Klein

主页: http://JK-Technology.Com

常见问题解答

comp.lang.c http://c-faq.com/

comp.lang.c ++ http://www.parashift.com/c++-faq-lite/

alt.comp.lang.learn.c-c ++
http://www.contrib .andrew.cmu.edu / ~a ... FAQ-acllc.html



--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html


ne *********** @ gmail.com 写道:
ne***********@gmail.com wrote:
我收到了一个恭维错误使用g ++ 3.4.2编译这个程序时。
谁能告诉我为什么?


这是某种谜语吗?

#include< iostream>
使用命名空间std;

模板< class T>
类列表{
类迭代器{
朋友类列表;
迭代器运算符++(){
返回* this;
} };
};

模板< class T>
list< T> :: iterator list< T> :: iterator :: operator ++(){
返回* this;
}
int main(){
返回0;
}
I got a compliation error when compiling this programs using g++ 3.4.2.
Who can tell me why?
Is this some kind of riddle?
#include<iostream>
using namespace std;

template<class T>
class list{
class iterator{
friend class list;
iterator operator++(){
return *this;
}
};
};

template<class T>
list<T>::iterator list<T>::iterator::operator++(){
return *this;
}

int main(){
return 0;
}






好吧,首先实现正确的运算符++。


你需要:

迭代器运算符++(int)


用于后缀递增。

ne ***** ******@gmail.com 写道:
Well, start off by implementing the correct operator++.

you need:
iterator operator++(int)

for postfix incrementing.

ne***********@gmail.com wrote:
使用g ++ 3.4.2编译这个程序时我得到了一个compliation错误。
谁能告诉我为什么?<谢谢。

#include< iostream>
使用命名空间st d;

模板< class T>
类列表{
类迭代器{
朋友类列表;
迭代器运算符++(){
返回* this;
}
};
};

模板< class T>
list< T> :: iterator list< T>: :iterator :: operator ++(){
返回* this;
}
int main(){
返回0;
}
I got a compliation error when compiling this programs using g++ 3.4.2.
Who can tell me why?
Thank you.

#include<iostream>
using namespace std;

template<class T>
class list{
class iterator{
friend class list;
iterator operator++(){
return *this;
}
};
};

template<class T>
list<T>::iterator list<T>::iterator::operator++(){
return *this;
}

int main(){
return 0;
}






这篇关于我有一个恭维错误。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆