Good morning all!
Many thanks in advance to anyone that can help me out with this matter.
I've been doing some work with Boost::Interprocess shared memory lately, and
finding it incredibly useful. I've successfully put interprocess mutexes
(muti?) and vectors to work, but for whatever reason, I can't seem to get
the hang of interprocess strings. I'm sure I'm just missing something
stupidly obvious, and to a degree I already see it but don't know what the
solution is.
For a vector, I know I've got a create a new interprocess allocator which
allocates whatever I want to store using the interprocess segment manager:
typedef boost::interprocess::allocator FooAllocator;
Then create a special vector which uses that allocator:
typedef boost::interprocess::vector
FooInterprocessVector;
This works great, provided I remember to find<FooInterprocessVector> on the
opposite process before accessing the vector during periods when it may have
been modified.
I can't seem to get the hang of strings though. I've looked around online
and can't seem to find an example of how this should be set up, and I can't
get it to accept an allocator. The only way I can seem to typedef one is
something like:
typedef boost::interprocess::string BoostString
- or -
typedef boost::interprocess::basic_string<char> BoostString;
Using this, so long as I only write a short string to the shared memory,
things work fine, but anything over a few characters quickly clobbers other
data. Has anyone used Interprocess::Strings before and could possibly point
me in the direction I'm going wrong? Thank you all!
--
View this message in context: http://old.nabble.com/Boost%3A%3Ainterprocess%3A%3Astring-problems-tp2920612...
Sent from the Boost - Users mailing list archive at Nabble.com.