Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5641: Multiple keys in same index for same value in multi_index
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-07-05 14:08:21
#5641: Multiple keys in same index for same value in multi_index
---------------------------------------------+------------------------------
Reporter: Aaron Moss <moss.aaron@â¦> | Owner: joaquin
Type: Feature Requests | Status: closed
Milestone: To Be Determined | Component: multi_index
Version: Boost 1.46.1 | Severity: Not Applicable
Resolution: wontfix | Keywords:
---------------------------------------------+------------------------------
Changes (by joaquin):
* status: new => closed
* resolution: => wontfix
Comment:
Hi Aaron,
The idea you propose is in direct contradiction with many basic
assumptions about the kind of data structures Boost.MultiIndex is designed
to generate: for one, all indices have the same size(), meaning that a
particular element appears once and exactly once in each index. Breaking
these basic assumption subvert the whole internal infrastucture of the
library, and it is not easy to see how this could be done in a
conceptually sound manner. In other words, I don't plan to augment
Boost.MultiIndex the way you propose.
You can approximate your scenario with some manual work: instead of
storing plain foos use some kind of proxy like
{{{
struct foo_proxy
{
boost::shared_ptr<foo> p;
boost::function<const baz&(const foo&)> key;
};
}}}
where p points to the actual element and key is a key extractor settable
at run time. Then, for each element x insert as many proxys as elements
has its s member, setting for each the appropriate key extractor returning
the i-th element of x.s. A collateral effect is that indices other than
the used for s will contain duplicates as well.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5641#comment:1> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:06 UTC