Boost logo

Boost Users :

Subject: Re: [Boost-users] multi_index_container for composite key
From: Uthpal Urubail (uthpal.urubail_at_[hidden])
Date: 2010-06-01 11:46:05


Thanks for the reply..
Let me put my requirement more clear.
I want to loop through and get all the element Ids[ member<Beam_entry,unsigned int,&Beam_entry::eid>] which are having the same member values[pid, orientX, orientY, orientZ, OffsetA and OffsetB].
I am expecting the count of the container to give the count of unique member entries.

Something like:
   for (beambook::iterator iter = pb.begin(), i_end = pb.end(); iter != i_end;
        iter = pb.upper_bound(iter->eid))
    {
        //print pid, orientX, orientY, orientZ, OffsetA, OffsetB VS VECTOR of eid's;
        
    }
Thanks
Uthpal

-----Original Message-----
From: boost-users-bounces_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Andrew Holden
Sent: Tuesday, June 01, 2010 7:10 PM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] multi_index_container for composite key

On Tuesday, June 01, 2010 5:41 AM, Uthpal Urubail wrote:
> Hi
> How could I loop through the container to get all the keys.
> Eg:
>       For(int i=0;i< beambook.count();++i)
> Or
>       Beambook:: iter1 = beambook.begin(), iter2 = beambook.end();
>
> My requirement is to loop through the size and list compositeKey vs list of element Ids
>
> Thanks,
> UJ   
>
> // define a multi_index_container with a composite key on
> typedef multi_index_container<
>     Beam_entry,
>     indexed_by<
>     //non-unique as some  might have more than ids
>     ordered_non_unique<
>         composite_key<
>             Beam_entry,
>             member<Beam_entry,unsigned int,&Beam_entry::pid>,
>             member<Beam_entry,double,&Beam_entry::orientX>,
>             member<Beam_entry,double,&Beam_entry::orientY>,
>             member<Beam_entry,double,&Beam_entry::orientZ>,
>             member<Beam_entry,double,&Beam_entry::OffsetA>,
>             member<Beam_entry,double,&Beam_entry::OffsetB>
>             >
>     >,
>     ordered_unique<
>     member<Beam_entry,unsigned int,&Beam_entry::eid>
>     >
>     >
> > beambook;

for (beambook::iterator iter = container.begin(), i_end = container.end(); iter != i_end; iter = container.upper_bound (get key from iter))

_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


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