Boost logo

Boost Users :

Subject: Re: [Boost-users] multi_index_container for composite key
From: joaquin_at_[hidden]
Date: 2010-06-02 02:20:26


Uthpal Urubail escribió:
> 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.
>

I think this is what you're after:

  for(beambook::iterator iter=pb.begin(),i_end=pb.end();iter!=i_end;){
    beambook::iterator iter_next=pb.upper_bound(pb.key_extractor()(*iter));
    // the bunch of elements in [iter,iter_next) have the same
    // [pid,orientX,orientX,orientZ,OffsetA,OffsetB]
    do{
      // print eid or whatever
    }while(++iter!=iter_next);
  }

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