On 11/23/06, Stephen Torri <[EMAIL PROTECTED]> wrote:
> On Thu, 2006-11-23 at 17:37 +0100, Pedro Lopez-Cabanillas wrote:
> > On 11/23/06, Stephen Torri <[EMAIL PROTECTED]> wrote:
> > > Is there a KDE 3.4+ or QT 3.3 hash table or hash function? I noticed
> > > that QT 4 has a hash table class called QHash but I did not think I
> > > could use this for the chord generation work I am doing.
> >
> > For the Qt (3.3) template library classes, see:
> > http://doc.trolltech.com/3.3/qtl.html
> >
> > For the STL containers (glibc implementation) see:
> > http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/group___containers.html
>
> I am aware of these containers. What I am looking for is something that
> will take a std::string and produce a unique hash value of it. Once I
> have this value I can use it as a key in a std::map for an O(1) lookup
> for the object associated with it.

Use __gnu_cxx::hash_map<> as suggested by Guillaume.
http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/hash__map.html

It is an extension to the standard library. Here is the documentation:
http://www.sgi.com/tech/stl/hash_map.html

You don't need to mess with the hashes, they are managed internally by
the implementation, but beware that hash_map gives you search
efficiency at the cost of iterate the keys with no guarantee of any
order.

Regards,
Pedro

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rosegarden-devel mailing list
[email protected] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Reply via email to