|
Boost Users : |
Subject: [Boost-users] accessing a pair<> element of multi_index container, uniquely ordered
From: Andrew Kokkalis (andrewkokkalis_at_[hidden])
Date: 2010-02-25 06:46:36
I have the following problem using a multi index container which is uniquely
ordered on a pair <int,int>.
Each time i want to find every pair i that contains a specific integer. The
other value of the pair is irrelevant.
An example:
<0,1>
<0,2>
<0,3>
<1,2>
<1,3>
<2,3>
and I want to find all the pairs with the value 0 as the first integer.
function find() wants the whole pair
and iterator find(const CompatibleKey& x,const CompatibleCompare&
comp)const; doesn't help ,too.
*
**Here is the declaration of my container**
typedef pair<int, int> clusterset;
struct cluster {
clusterset pair;
float distance;
cluster(clusterset pair, float distance) :
pair(pair), distance(distance) {}
};
struct cluster_pair{};
struct cluster_distance{};
typedef multi_index_container<
cluster,
indexed_by<
ordered_unique<
tag<cluster_pair>, BOOST_MULTI_INDEX_MEMBER(cluster, clusterset,
pair)>,
ordered_non_unique<
tag<cluster_distance>, BOOST_MULTI_INDEX_MEMBER(cluster, float,
distance)> >
> cluster_index;*
Any ideas?
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