boost::interprocess::string
El 28/12/2011 10:28, Josmon Paul escribió:
Hi All Is there any way to increase the size of boost::interprocess::string greater than 10. In my code currently i am using a vector to store the object and dumbing this vector into shared shared memory. The object inturn contain various field and it has string type of data with it. Currently i am defining the string as as "boost::interprocess::string "and setting to the object field. But when i am fetching it is giving segmentation fault for string size more than 10 due to the limitation of boost::interprocess string . Is there any other type of string which can be replaced with boost::interprocess::string. I cant use basic_string because i think it is suited if we are adding only string type of data to the vector list (i am guessing) .
You must use a shared memory allocator with a string. Until 10, string uses an internal buffer, but then it must allocate dynamic memory and you need to configure it like a shared memory container. You have some examples in the documentation, you can see how to construct a vector of strings in the example here: http://www.boost.org/doc/libs/1_48_0/doc/html/interprocess/allocators_contai... Best, Ion
participants (2)
-
Ion Gaztañaga
-
Josmon Paul