Boost logo

Boost :

From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2004-03-23 17:33:56


>

I forgot to answer one of your questions. Here it comes:

Joerg Walter <jhr.walter <at> t-online.de> writes:
> One more question: is there an (easy?) way to
> iterate over the distinct values of an index

You can do it as you would with a std::multiset:

typedef indexed_set<...> indexed_t;
typedef indexed_t::index_type<...>::type index_t;

indexed_t iset;
index_t& index=iset.get<...>();

for(index::iterator it=index.begin();it!=index.end()){
  // do what you want to with the value

  // get next value
  it2=index.upper_bound(index.key_extractor()(*it));
  it=it2;
}

> (or to define the index as the
> set of distinct values of the related attribute(s))?

This would call for a new type of index, IHMO. Gotta
think it over.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk