Srinivas Gardas escribió:
Hi, I am quite new to boost. Are there any code examples around usage of 'open_or_create' mode for ceating the shared_memory_object? My problem is, after we create a 'shared_memory_object' using 'open_or_create' there is no way to know whether it created 'created' a file or 'opened' an already existing file. We need this apparently, because if we are creating a new file, we have to '*construct<container>("MySharedMemory") *' the file with the desired container, otherwise we have to '* find<container>("MySharedMemory")*'. All the usage examples I could get were only around 'create_only' and then 'open_only' modes..
Currently there is no way to know that, but you can use "find_or_construct", to construct the needed type if it's not already constructed. If it's not constructed, the function returns a pointer to the constructed object. Regards, Ion