hi all

a few weeks ago i came across multi index and now im using it very intensively in my linux application (using g++)
the problem im facing more often is a situation like this:

i have a structure using multi index for server's (for example)
typedef struct server{
    uint32_t ip,port;
    std::string hostname;
};

and i have a groups structure
typedef struct servergroup{
    std::string groupname;
    uint32_t groupid;
    time_t sometimestamp;
    uint32_t groupstate;
//  std::vector<server> members;  // << could this be a multi_index?
};

what i need to do is create a relation between a group and it's members (servers)
and thats what im not sure about how to achive using multi_index

the reason for the relationship is that i need to create an index for queries like this:
In which group is server X?
or
Which servers has Group X?

The only possibility i see is by creating 1 structure which causes much memory overhead and
updating is a bit of a problem, cause i would need a loop for updating the state of the group for every member, ...

I also thought about using boost bimap, but im pretty unsure how?
So anybody has a hint on this (including maybe a very small example)?
im pretty sure its some kind of 'not see the wood for trees' problem

thx for ur time


Discover the new Windows Vista Learn more!