Boost logo

Boost Users :

Subject: Re: [Boost-users] [multi-index] Key extractor for 1:n relationship?
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2009-07-17 09:54:51


I remember to ask a similar question. I was told that it is not supported.
Finally I reconsidered my design, which was more optimal at all. On the
other hand, it is not said that hash works optimal in that case. You might
better do a lexicographical_compare to the keys and find first one of the
keys from the set, as to hash all and look-up for hash values. Therefore a
multi-map or multi-set as part of your multi-index might be a better choice.
Otherwise, you need to hash all possible tuple combinations, which is an
NP-complete problem.

There is a nice article in Dr.Dobb's on what is more efficient hash based
container or stl::set or map.

http://www.ddj.com/cpp/198800559?pgno=1

Hope that helps,

Regards,
Ovanes

On Fri, Jul 17, 2009 at 2:15 PM, Boris Schaeling <boris_at_[hidden]> wrote:

> On Fri, 17 Jul 2009 07:12:00 +0200, plarroy <plarroy_at_[hidden]> wrote:
>
> Either you misunderstand me or I misunderstand you. :) The hash value would
> be created for the entire vector? I want to use a string in the vector as a
> key, not the entire vector itself. If an employee has the names Tom and John
> I want to find the employee also if I only search for Tom. There would be
> one employee object in the container but two hash values would need to be
> generated. Not sure if this is possible at all?
>
>
> Boris
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net