Boost logo

Boost Users :

Subject: Re: [Boost-users] Multi Index: Nested std::pair
From: Etienne Philip Pretorius (icewolfhunter_at_[hidden])
Date: 2009-04-26 19:48:28


Hello List,

Continuing from the last post.. I have the following defined:

         struct element_t {
             element_t(
                 unsigned char value,
                 unsigned char x,
                 unsigned char y
             ):value(value),x(x),y(y){}
             unsigned char value;
             unsigned char x;
             unsigned char y;
         };

         typedef boost::multi_index_container<
             element_t,
             boost::multi_index::indexed_by<
                 /*value*/
                 boost::multi_index::ordered_non_unique<
                     boost::multi_index::member<
                         element_t,
                         unsigned char,
                         &element_t::value
>
>,
                 /*x co-ordinate*/
                 boost::multi_index::ordered_non_unique<
                     boost::multi_index::member<
                         element_t,
                         unsigned char,
                         &element_t::x
>
>,
                 /*y co-ordinate*/
                 boost::multi_index::ordered_non_unique<
                     boost::multi_index::member<
                         element_t,
                         unsigned char,
                         &element_t::y
>
>,
                 /*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?

Many Thanks,
Etienne


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