Boost logo

Boost Users :

From: Kowalke Oliver (QD IT PA AS) (Oliver.Kowalke_at_[hidden])
Date: 2008-01-09 03:32:18


Hi Joaquín,

> Hi Oliver,
> I think there's a misunderstanding here about the usage of
> composite keys with
> range(): note that the composite key-based index sorts the
> elements of p according to a lexicographical order on
> (descending function, descending active); for instance, the
> values you insert in your example get sorted as follows:
>
> (1.1,false),(1,true),(0,true),(-1,true),(-1,false),(-1.1,true).

Yes - I didn't noticed this. Thank you!

> // get all elements with function>=0 and arbitrary active:
> these do always form
> // a range.
> std::pair<
> idx_type::iterator,
> idx_type::iterator
> > p(
> idx.begin(),
> idx.upper_bound( boost::make_tuple(0.0) ) );
>
> // filter out the elements with !active
> for ( ; p.first != p.second; ++p.first)
> if(p.first->active)
> std::cout << p.first->function << " " << std::boolalpha
> << p.first->active << std::endl;

Would this result in an algorithm complexity of ( n lg n) in the worst case
(function >= 0 and active == false for all elements)?

kind regards,
Oliver


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