|
Boost Users : |
Subject: Re: [Boost-users] Multi Index: Nested std::pair
From: joaquin_at_[hidden]
Date: 2009-04-27 04:20:20
Etienne Philip Pretorius escribió:
> Etienne Philip Pretorius wrote:
>
>>> /*unique values per x co-ordinate*/
>>> boost::multi_index::ordered_non_unique<
>>> boost::multi_index::composite_key<
>>> element_t,
>>> boost::multi_index::member<
>>> element_t,
>>> unsigned char,
>>> &element_t::x
>>> >,
>>> boost::multi_index::member<
>>> element_t,
>>> unsigned char,
>>> &element_t::value
>>> >
>>> >
>>> >
>>> >
>>> > matrix_t;
>>>
>>> How would I define the "unique values per x co-ordinate" as there x
>>> co-ordinate is suppose to be non unique while value in this key should
>>> ONLY point to unique instances within that x co-ordinate?
>>>
>>>
>> Would this work?
>>
>> /*unique values per x co-ordinate*/
>> boost::multi_index::ordered_unique<
>> boost::multi_index::composite_key<
>> element_t,
>> boost::multi_index::member<
>> element_t,
>> unsigned char,
>> &element_t::x
>> >,
>> boost::multi_index::member<
>> element_t,
>> unsigned char,
>> &element_t::value
>> >
>> >
>> >
>>
>> As it is not clear in the documentation what the
>> "boost::multi_index::ordered_unique" scope is. IE is it the combination
>> of the defined members (member vs member) of is it based on the first
>> and then on the second (first vs first, second vs second).
>>
>>
>
> The above does not seem to be correct as the algo does not succeed.
> Could someone please give me advise on constructing a key that has
> duplicate ("x" || "y") members while unique "values".
>
Hi Etienne,
Could you please elaborate on what is meant by "unique values"? This is
not clear to
me from the explanations on your previous posts. It might help to state
your requirements
in the reverse way: what kind of duplications involving value should be
banned from the
container? For instance, the ordered_unique index you show us above bans
duplicate
elements having the same form (x,*,value), where * indicates that the y
member is
immaterial here.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
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