|
-
December 17th, 2007, 07:19 AM
#1
STL & hash_set problem
Hello,
I'm new to the forums and this is my first post (not sure if it's in the right place) and i'm also a beginner at programming in c++, so bear a little with me.
I'm trying to get the STL hash_set included in my code but i'm getting some wierd problems compiling (very big compiling error). Firstly, i don't know if i installed STL correctly (extracted to include dir in devc++). Second, i included the hash_set (#include <hash_set.h>) in a simple example program and getting the huge compile error. I think it's a very common problem but due to my ignorance i'm unable to solve it. I hope no additional information is required as i think many of you may already know what is going on.
Thanks,
Unrul3r
PS: Sorry if the post is a bit messy/sloppy but i'm in a bit of a hurry
Last edited by Unrul3r; December 17th, 2007 at 07:54 AM.
-
December 17th, 2007, 08:01 AM
#2
Re: STL & hash_set problem
Perhaps you should post your errors? This will tell you how to use code tags.
-
December 17th, 2007, 08:39 AM
#3
Re: STL & hash_set problem
What STL are you exactly talking about?
Most of the STL has become part of the C++ standard, thus any C++ compiler will contain STL. However, hash set was one of the few components that did not make it into the standard.
If you've downloaded some STL source code somewhere (SGI?) and extracted it into your include directory, you will probably have created a mess, due to the mixture of STL files that came with the compiler and extracted ones.
I suggest you use boost (www.boost.org) for a hash set implementation. Boost builds upon the current C++ standard and thus does not overlap with your compiler implementation of STL.
More computing sins are committed in the name of efficiency (without necessarily achieving it) than for any other single reason - including blind stupidity. --W.A.Wulf
Premature optimization is the root of all evil --Donald E. Knuth
Please read Information on posting before posting, especially the info on using [code] tags.
-
December 17th, 2007, 08:53 AM
#4
Re: STL & hash_set problem
Yes, it was SGI. I will delete all files of SGI STL from the dir since none have collided with original files and check out Boost. Thanks a bunch, Will report soon.
Edit: Boost seem really nice will try it in the future, but a friend of mine got it working, i was putting some files in the wrong dirs so i ended up using SGI STL . Thanks very much anyways for the fast response from all!
Last edited by Unrul3r; December 17th, 2007 at 10:12 AM.
-
December 18th, 2007, 11:03 AM
#5
Re: STL & hash_set problem
Have another question: I'm not understanding very well the implemented concept of hash_set, so i would like to know how do i define the hash_set type. i want like a hashtable with with elements of type string but a key of int type.
hash_set <int> defines only teh type of the key right? what about the elements?
Regards
-
December 18th, 2007, 11:32 AM
#6
Re: STL & hash_set problem
I think you probably want a hash_map instead.
-
December 18th, 2007, 11:40 AM
#7
Re: STL & hash_set problem
or just a std::map if the key is int.
More computing sins are committed in the name of efficiency (without necessarily achieving it) than for any other single reason - including blind stupidity. --W.A.Wulf
Premature optimization is the root of all evil --Donald E. Knuth
Please read Information on posting before posting, especially the info on using [code] tags.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|