This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
is this an error ??
- To: gcc-bugs at gcc dot gnu dot org
- Subject: is this an error ??
- From: fabiosmoker <fabiosmoker at libero dot it>
- Date: Sat, 13 Oct 2001 21:24:25 +0200
this program don't work............
the keyword "static" don't work ;
#include <iostream>
#include <vector>
#include <iterator>
class A {
public:
struct prova {
int i ;
};
std::vector<struct prova> base ;
std::vector<struct prova>::iterator ty (void)
{
/**********/
//this programm don't work
//
static std::vector<struct prova>::iterator iter = base.begin();
//
//is this an error ???
return (iter) ;
}
A ( std::vector<struct prova>& k ) { base = k ;}
};
int main (void ) {
struct A::prova k ,l ;
k.i = 1 ;
l.i = 2 ;
std::vector<struct A::prova> ta ;
ta.push_back(k) ;
A pippo ( ta ) ;
std::vector<struct A::prova>::iterator oi = pippo.ty() ;
std::cout << (*oi).i << "\n" ;
std::vector<struct A::prova> tb ;
tb.push_back (l) ;
A pluto ( tb ) ;
std::vector<struct A::prova>::iterator of = pluto.ty() ;
std::cout << (*of).i << "\n" ;
}