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...

Edited by asxoliastos: n/a

7 Years
Discussion Span
Last Post by asxoliastos

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...

Edited by asxoliastos: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.