I am new to this forum so be patient..

I am currently having an issue with a map iterator

well the code i am talking about:

leafnode<LeafEntry<recno_t> ,blocknum,char*,recno_t>* 
	descend(Object<dimensionality,Type>& ob,nonleafnode<NonLeafEntry<dimensionality,Type>,dimensionality,Type>* rt,blocknum* leafblocknum){
		std::map< int,NonLeafEntry<dimensionality,Type>* >* entries;
		std::map< int,NonLeafEntry<dimensionality,Type>* >::iterator it;

		leafnode<LeafEntry<recno_t> ,blocknum,char*,recno_t>* L;
		int i,elements;
		if(rt == NULL) return NULL;
		entries = rt->get_entries();
		elements = rt->get_elements();
		for(it = entries->begin() ; it != entries->end() ; it++){
				if( (*it).second->get_type()==1){
					L = take_page((*it).second->get_child());
					*leafblocknum =(*it).second->get_child();
					return L;
				} else {
					nonleafnode<NonLeafEntry<dimensionality,Type>,dimensionality,Type>* D;
					D = take_page< nonleafnode<NonLeafEntry<dimensionality,Type>,dimensionality,Type> >((*it).second->get_child());
					L = descend(ob,D);
					if(L) return L;
		return NULL;

The problem i have is that g++
shows me something strange:

In file included from main.cpp:2:
GCtree.hpp: In member function ‘leafnode<LeafEntry<long long int>, B, char*, long long int>* GCbuilder<dimensionality, blocksize, B, Type>::descend(Object<dimensionality, Type>&, nonleafnode<NonLeafEntry<dimensionality, Type>, dimensionality, Type>*, B*)’:
GCtree.hpp:183: error: expected ‘;’ before ‘it’
GCtree.hpp:190: error: ‘it’ was not declared in this scope

Can anybody understands why this thing is happening??

//The problem is faced at line 4 of the above code...

well while you were typing your post i was writing mine..

i quess we reached the same place from different directions..

thnx a lot my friend..

i just should type typename before the iterator definition...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.