Why wxHashMap Iterator is not working? Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Sunsawe
Experienced Solver
Experienced Solver
Posts: 54
Joined: Tue Jan 30, 2007 5:04 pm

Why wxHashMap Iterator is not working?

Post by Sunsawe » Wed May 30, 2007 9:09 pm

Hi,

I created a hashmap(wxString,wxString) with wxWidgets 2.8.3. I did it by that way:

Code: Select all

WX_DECLARE_STRING_HASH_MAP( wxString, wxStringHashMap );
Then created an object to use it:

Code: Select all

wxStringHashMap hashtest;
hashtest[X] = Y;

wxStringHashMap::Iterator it;

for(it = hashtest.begin(); it!= hashtest.end() ; it++)
	{
	Display(it->first);
        Display(it->second);
	}
But when i'm trying to compil it, i have these errors:

Code: Select all

binary '++' : 'wxStringHashMap_wxImplementation_HashTable::Iterator' does not define this operator or a conversion to a type acceptable to the predefined operator

type 'wxStringHashMap_wxImplementation_HashTable::Iterator' does not have an overloaded member 'operator ->'

'first' : is not a member of 'wxStringHashMap_wxImplementation_HashTable::Iterator'

'second' : is not a member of 'wxStringHashMap_wxImplementation_HashTable::Iterator'
What am i doing wrong?

Thanks

tan
Moderator
Moderator
Posts: 1471
Joined: Tue Nov 14, 2006 7:58 am
Location: Saint-Petersburg, Russia

Re: Why wxHashMap Iterator is not working?

Post by tan » Thu May 31, 2007 6:26 am

Hi,
Sunsawe wrote:Hi,

I created a hashmap(wxString,wxString) with wxWidgets 2.8.3. I did it by that way:

Code: Select all

WX_DECLARE_STRING_HASH_MAP( wxString, wxStringHashMap );
Then created an object to use it:

Code: Select all

wxStringHashMap hashtest;
hashtest[X] = Y;

wxStringHashMap::Iterator it;  <----- Error is here, not Iterator but iterator

for(it = hashtest.begin(); it!= hashtest.end() ; it++)
	{
	Display(it->first);
        Display(it->second);
	}
But when i'm trying to compil it, i have these errors:

Code: Select all

binary '++' : 'wxStringHashMap_wxImplementation_HashTable::Iterator' does not define this operator or a conversion to a type acceptable to the predefined operator

type 'wxStringHashMap_wxImplementation_HashTable::Iterator' does not have an overloaded member 'operator ->'

'first' : is not a member of 'wxStringHashMap_wxImplementation_HashTable::Iterator'

'second' : is not a member of 'wxStringHashMap_wxImplementation_HashTable::Iterator'
What am i doing wrong?

Thanks
OS: Windows XP Pro
Compiler: MSVC++ 7.1
wxWidgets: 2.8.10

Sunsawe
Experienced Solver
Experienced Solver
Posts: 54
Joined: Tue Jan 30, 2007 5:04 pm

Post by Sunsawe » Thu May 31, 2007 4:31 pm

i feel a bit stupid...
sorry for that...

Post Reply