|
Boost Users : |
Subject: Re: [Boost-users] Lookup on composite key in MultiIndex
From: Chris Jewell (chris.jewell_at_[hidden])
Date: 2010-12-06 10:30:27
On 3 Dec 2010, at 18:44, JOAQUIN M. LOPEZ MUÑOZ wrote:
>
> Hi Chris,
>
> I'm afraid to say that there is no way you can do that with
> Boost.MultiIndex: Any lookup operation with Boost.MultiIndex
> returns a *contiguous* range of elements, and it is mathematically
> impossible to order an arbitrary set of Individual's in a way that
> all the sets of the form
>
> Individual::I < T and Individual::N > N
>
> are contiguous according to the order. These type of bi-dimensional
> lookups require (if you want to make them efficiently) some
> sort of special data structure such as kd-trees. Otherwise the best
> you can do is
>
> lookup for Individual::I < T
> traverse the returned range and filter elements with Individual::N > N
>
> which is linear in time complexity (but maybe acceptable for your
> needs).
Hi,
Thanks Joaquin, that's very useful to know!
Chris
-- Dr Chris Jewell Department of Statistics University of Warwick Coventry CV4 7AL UK Tel: +44 (0)24 7615 0778
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