Re: STL iterator problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

gcc is right to reject this code, something more
standard compliant should pass :

for(typename B::iterator i; ...)

Regards,

PH
 --- Yogesh Kini <kini1982@xxxxxxxxxxxxxxxx> a écrit :

> Hi,
> Please take a look at the code snippet below.
> The code compiles fine with Microsoft VC++ but gives
> a error with gcc(as indicated below)
> I am trying to port the file from msvc to gcc. Can
> anyone suggest me a work around. 
> 
> Thanks
> Yogesh
> 
> 
> #include <stdio.h>
> #include <list>
>  
> template <class B>
> class parent
> {
> public:
> 	B * m_Container;			
> 	void funone();
> 	void CreateList()
> 	{
> 		m_Container = new B();  
> 		m_Container->push_front(1);		
> 		m_Container->push_front(2);		
> 		m_Container->push_front(3);		
> 		m_Container->push_front(4);		
> 	}
> 	B * GetList()
> 	{
> 		return (m_Container);
> 	}
> };
>  
> 
> template<class B>
> void parent<B>::funone()
> {
> 	B * the_Container = GetList();
> 	for(B::iterator i = the_Container->Begin(); i !=
> the_Container->end(); ++i  )  -> Error Here: Parse
> error before "=" token
> 	{
> 		printf("%d ",*i);	
> 	}	
> }
>  
> int main()
> { 
> 	parent<std::list<int>> the_instance;
> 	the_instance.CreateList();
> 	the_instance.funone();
> }
> 
> Error: parse error before "=" token
> 
> 
> 
> ___________________________________________________
> Have your own email and web address for life.
> 
> http://www.homemaster.net - Homemaster. Come
> Together. Online.
> 
>  


	

	
		
Vous manquez d?espace pour stocker vos mails ? 
Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux