|
Boost Users : |
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2006-11-27 09:04:56
Oliver.Kowalke_at_[hidden] wrote:
> Hello,
> The example below should print out only the items {1.0, true} and {2.0,
> true} but not {1.5, false}.
> What is going wrong?
>
The result is correct. Composite keys do comparison from left to right:
only when the weight is equal is the assignability even considered for
sorting. Thus, {1.5, false} sorts between {1.0, true} and {2.0, true}
and thus is part of your range.
Switch the order in your composite key and you'll get the results you
expect:
mi::composite_key<
item,
mi::const_mem_fun<
item,
bool,
&item::asignable
>,
mi::const_mem_fun<
item,
double,
& item::weight
>
>
Sebastian Redl
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