I will definetly try what you have suggested and get back to you, thank you for your quick reply!

JOAQUIN LOPEZ MU?Z wrote:
[...]

Hello Sebastien,

I'm not sure I've fully understood all the details of your problem,
but seems to me that composite keys ( http://tinyurl.com/hdf3q )
might be of help here. A composite key accepts several attributes
and presents the records sorted in lexicographical order
with respect to them. In your particular case, suppose you've
got an index (non-unique) whose key is

composite_key<
  meteo_record,
  const_mem_fun<meteo_record,const 
string&,&meteo_record::get_grid_type>,
  const_mem_fun<meteo_record,const 
string&,&meteo_record::get_var_name>,
  const_mem_fun<meteo_record,float,&meteo_record::get_ip2>,
  const_mem_fun<meteo_record,int,&meteo_record::get_ip1Kind>,
  const_mem_fun<meteo_record,float,&meteo_record::get_ip1>
  

(where I've used some imaginary names for the attribute getters).
This index sorts records lexicographically by

  grid_type,var_name,ip2,ip1Kind,ip1

which looks like what you're after, from what I understand about
the description of your current query process. The different
groups can be then traversed like follows (for simplicity I
assume the composite key is used in index #0, you'll probably want
to have it in an additional index):

for(recordIter=set.begin();recordIter!=set.end();)
{
  recordIter2=set.upper_range(
    boost::make_tuple(
      it->get_grid_type(),
      it->get_var_name(),
      it->get_ip2(),
      it->get_ipKind(),
    )
  );

  // [recorditer1,recorditer2) is a range of elements with equal
  // grid_type,var_name,ip2 and ipKind, sorted by ip1
  process(recordIter1,recordIter2);
  
  recordIter1=recordIter2;
}

Is this what you were looking for? Thank you for using
Boost.MultiIndex,

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

  


--

Sébastien Fortier

Analyste-Programmeur
Centre Météorologique Canadien

2121, voie de service nord, Trans-Canadienne
Dorval, QC
H9P 1J3

Tel: (514) 421-5049    Fax: (514) 421-4657
Courrier électronique:   Sebastien.Fortier@ec.gc.ca