|
Boost Users : |
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2007-10-05 16:21:54
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
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net