Axel escribió:
I'm trying to use multi_index to store objects pointers. These objects have mainly 3 fields : - string name - int id - int block_id
[...]
The name & id indexes work well but I dont manage to get the Foo* pointers for a given block_id. I m using : foo_list_.get
().find(1) to grab the wanted list. My problem is that in the result I have not only Foo instances from the block 1. This is what I get when I try to query for a given block_id : For block 5 : only objects with block_id == 5 For block 4 : objects with block_id == 4 and 5 For block 3 : objects with block_id == 3, 4 and 5 For block 2 : objects with block_id == 2, 3, 4 and 5 and so on.
I think you need to use equal_range here:
// return a range comprising objects with block_id==3
foo_list_.get