Jump to content
  • Advertisement
Sign in to follow this  

Complier warning

This topic is 4664 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. I have the following class (modified from Data Structures for Game Programmers by Ron Penton) that implements a hash table.
template <class DataType>
struct hash_entry
  std::string m_Key;
  DataType m_Data;

template <class DataType>
class hash_table
    int m_Size;
    int m_Count;
    std::vector< std::list< hash_entry<DataType> > > m_Table;
    unsigned long int hash(std::string Key);
    hash_table(int p_Size) : m_Size(p_Size), m_Count(0), m_Table(p_Size) { }
    ~hash_table() { m_Size = 0; m_Count = 0; }
    void insert(std::string p_Key, DataType p_Data);
    hash_entry<DataType>* find(std::string p_Key);
    void remove(std::string p_Key);

Here is the find() function...
template <class DataType>
hash_entry<DataType>* hash_table<DataType>::find(std::string p_Key)
  int Index = hash(p_Key) % m_Size;
  std::list< hash_entry<DataType> >::iterator EntryItr = m_Table[Index].begin();
  while(EntryItr != EntryItr.end())
    if((*EntryItr).m_Key == p_Key) { return(&(*EntryItr)); }

Whenever I compile, I receive the warnings
[Warning] ` std::list<hash_entry<DataType>, std::allocator<hash_entry<DataType> > 
[Warning] implicit typename is  deprecated, please see the documentation for details
Both warnings point to this line in the find() function...
std::list< hash_entry<DataType> >::iterator EntryItr = m_Table[hash(p_Key) % m_Size].begin();
Any idea how to fix this? If you find any other errors / problems, please share those too. Thanks in advance.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!