由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - iterator一问
相关主题
c++ template question:请问这是什么错误呀
一个C++的概念问题C++ template question
呼唤大侠们,我实在不能实现C++泛型的精神。再问两个C++问题
STL感觉实在太变态了C++ template function一个问题
[菜鸟问题]类模板问题partial_sort问题
stl 的 member type 看起来挺头大的please help debug this code
讨论 找单链表倒数m的节点 (转载)return Triangular_iterator( _beg_pos );意思
C++ 菜鸟问一个关于template 的问题。a c++ question
相关话题的讨论汇总
话题: iterator话题: vector话题: os话题: data话题: endl
进入Programming版参与讨论
1 (共1页)
j*****k
发帖数: 1198
1
template
void lstack::print(ostream& os)
{
if(data==NULL) return;
vector::iterator i; // error: expected `;' before ‘i’
for(i=data->begin(); iend();i++) //error: ‘i’ was not
declared in this scope
os< os< return;
};
大家帮忙看看,这两个错误怎么回事?不解。用的是gcc version 4.1.3 20070929
t****t
发帖数: 6806
2
typename vector::iterator i;

【在 j*****k 的大作中提到】
: template
: void lstack::print(ostream& os)
: {
: if(data==NULL) return;
: vector::iterator i; // error: expected `;' before ‘i’
: for(i=data->begin(); iend();i++) //error: ‘i’ was not
: declared in this scope
: os<: os<: return;

h****e
发帖数: 2125
3
iterator is a dependent name in 'vector', you have to explicitly bring it
into the vector's scope or fully qualify it.

【在 j*****k 的大作中提到】
: template
: void lstack::print(ostream& os)
: {
: if(data==NULL) return;
: vector::iterator i; // error: expected `;' before ‘i’
: for(i=data->begin(); iend();i++) //error: ‘i’ was not
: declared in this scope
: os<: os<: return;

1 (共1页)
进入Programming版参与讨论
相关主题
a c++ question[菜鸟问题]类模板问题
template questionstl 的 member type 看起来挺头大的
这两个地方是否需要typename?讨论 找单链表倒数m的节点 (转载)
这段 C++ 怎么改才能编译?C++ 菜鸟问一个关于template 的问题。
c++ template question:请问这是什么错误呀
一个C++的概念问题C++ template question
呼唤大侠们,我实在不能实现C++泛型的精神。再问两个C++问题
STL感觉实在太变态了C++ template function一个问题
相关话题的讨论汇总
话题: iterator话题: vector话题: os话题: data话题: endl