Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Proposal on *Index: access via hash value
Re: Proposal on *Index: access via hash value [message #20686 is a reply to message #20684] Tue, 31 March 2009 16:21 Go to previous messageGo to previous message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
luzr wrote on Tue, 31 March 2009 14:23

How do you finds items then? Using fake CollectionElement as key?


Mirek

I think thats the problem isn't it?

You have something like this no?
struct CollectionElement : public Moveable<CollectionElement>
{
   String unique_id;
   Value data; // Whatever
};

struct Referer : public Moveable<Referer>
{
   String unique_id;
   Value data; // Whatever
   String collection_id;
}

Index<CollectionElement> collection;
Vector<Referer> ref;

int FindRefCollection(Referer &ref) {
   unsigned collection_hash = GetHashValue(ref.collection_id);
   // Now we need to find the CollectionElement by hash only
   // but the closest you can get is Find(T &x, unsigned hash)
   return -1;
}

Since AIndex::hash is protected you can of course just inherit and add the memebr yourself, but it wouldn't be ideal.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Problem with Core/Mt.h Mutex and RWMutex
Next Topic: .ini file
Goto Forum:
  


Current Time: Fri Jul 18 16:22:32 CEST 2025

Total time taken to generate the page: 0.02590 seconds