Boost logo

Boost Users :

Subject: [Boost-users] Lookup on composite key in MultiIndex
From: Chris Jewell (chris.jewell_at_[hidden])
Date: 2010-12-03 08:00:01


Hi All,

A question about fast lookup on ordered indices, if I may. I have a data structure:

struct Individual
 {
        double I;
        double N;
        ...
}

I need some way of indexing Individuals such that I can perform queries such as "Return the set of Individuals such that Individual::I < T and Individual::N > N". I'm currently using a MultiIndex that orders the individuals by Individual::I, and therefore gives me fast lookups on the I field.

I had thought about creating a composite key on both I and N, and then using the range() method to return iterators to the required individuals. However, I can't seem to find the correct syntax for a predicate for the composite key. Can anyone help me out? Is there a better way to achieve what I need?

Thanks,

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