Boost logo

Boost :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2006-08-21 07:03:36


Tal Agmon ha escrito:

> Hi Joaquin,
>
> Sorry for the lack of info in my previous quote.
> I appreicate your affort to promptly help me.
>
> What I have is a non_unique which I carry to get all the keys.( I
> don't care about the elements)
>
> My guess is that key_extractor() returns a key_form_element, is quite
> redundant in my case.
>

Hello again.

Still I'm having difficulties with understanding your question, but let me
try my hand: are you looking for a way to produce all *different* key
values contained by an index? If so, something like the following would do:

for(index_t::const_iterator it=i.begin();it!=i.end();){ // note: no ++it
  // output the key
  std::cout<<i.key_extractor()(*it)<<std::endl;

  // jump to the next different key value
  it=i.upper_bound(i.key_extractor()(*it));
}

Now, is this what you were asking about?

>
> Regards
> Tal
>

Best,

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