This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

is this an error ??



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" ;
    
}    


      


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]