Robert Kubrick wrote:
A couple of beginner questions on basic_managed_heap_memory:
1) I want to access elements in the contiguous memory segment by using an int key, rather than a char string. Can I declare something like this:
typedef basic_managed_heap_memory < int, /* my key is an integer */ rbtree_best_fit
, flat_map_index managed_heap_memory;
I need to lookup objects using an external integer ID but the ID can have any value (ie, does not match the 0-N array element order of my memory segment).
No sorry, named allocation is only availables for chars. One workaround thing you can do is to allocate anonymous objects in the managed segment and create another map-like structure pointing to those anonymous objects. More inefficient, I know, but I can't think another way. Anyway, I think you've shown me a good use case to study the possibility of using non-char indexes (something I suspect will require a lot of work, because all the code supposes string keys).
2) If I want to insert multiple objects with the same char* name (ala multimap) can I create a flat_multimap_index?
You can't. Names must be unique because it should identify a unique named object. Otherwise, we wouldn't be capable to find an object correctly. Regards, Ion