Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


iterators in hash_map data

This topic is 5856 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

I would like to use a structure as the data for a hash_map, and I want the structure to contain iterators to elements in the hash_map, but the compiler is giving me errors. For example, this code would give an error:
#include <iostream>
#include <hash_map>

using namespace std;

template<class T>
class HashData
        hash_map<T, HashData<T>, hash<T>, equal_to<T> >::iterator it;


int main()
    HashData<int> bob;

    return 0;


stl_pair.h: In instantiation of 'pair<const int, HashData<int> >':

stl_hashtable.h:239:  instantiated from '_Select1st<pair<const int,HashData<int> > >'

stl_hashtable.h:239:  instantiated from 'hashtable.h:239:  instantiated from 'hashtable<pair<const int,HashData<int> >,int,hashallocator<HashData<int> > >'

test.cpp:11:  instantiated from 'HashData<int>'
test.cpp:18:  instantiated from here

stl_pair.h:39: invalid use of undefined type 'class HashData<int>'
test.cpp:13: forward declaration of 'class HashData<int>'
stl_pair.h:50: confused by earlier errors, bailing out

Is this just something that you can't do, or am I doing something incorrectly? Jeremy Bell [edited by - Magmai Kai Holmlor on November 3, 2002 9:10:23 PM]

Share this post

Link to post
Share on other sites

  • 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!