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?