You are right.
I'm not very familiar with the allocator specification.
However, does the structure (as hash_map) requests the memory from the
allocator for *any* object it creates (such as different helper objects it
creates during the initialization), or does it requests memory *only* for
inserting pairs into the structure ?
If it is the latter then it is not very suitable for me.
Thanks,
"Victor Bazarov" <v.Abazarov@comAcast.net> wrote in message
news:f9cpem$t89$1@news.datemas.de...
> Dima Stopel wrote:
>> I need to write an application that shares some object via shared
>> memory with other applications.
>>
>> I use Memory-Mapped Files technique in order to share memory.
>>
>> Thus, in each process I have the *same* region of memory that is
>> shared.
>> All I need now is to put my object into this region.
>>
>> I use 'placement new' technique in order to put the object and all
>> objects it creates in its constructor into this region.
>>
>> However, let's say that the object creates a hash_map in the
>> constuctor. The hash_map is placed inside the region as needed,
>> however if hash_map also creates some objects in *it's* constructor
>> they won't be placed into the region and I have no control over it.
>> Thus, the other applications which will try to call methods of my
>> object will fail because those objects that hash_map creates are not
>> inside the shared region.
>> How can I ensure that the *whole* object with all it's sub-objects
>> will be inside the shared region? Is it possible?
>
> I guess you're using the terms "whole object" and "sub-objects" too
> freely. Whatever a hash_map creates are not its "sub-objects". That
> said, I believe you need to look into the Allocator template argument
> any standard container has. It is unclear from your posting whether
> you already know about those.
>
> V
> --
> Please remove capital 'A's when replying by e-mail
> I do not respond to top-posted replies, please don't ask
>