27 Nov
2006
27 Nov
'06
2:04 p.m.
Oliver.Kowalke@qimonda.com 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