Carlos
Carlos

Reputation: 167

array of std::string in shared memory.

I wonder how visual c++ std::string is populated in memory.
For example if I declare std::string container[10] in a shared memory region, then can I insert any length of string into this array at run-time ?
Since it is known that shared memory region can not expand at run-time, then how can we insert varying size of strings into this array ?

Upvotes: 1

Views: 1269

Answers (1)

Reto Koradi
Reto Koradi

Reputation: 54592

That sounds like a really bad idea. std::string involves dynamic memory allocation, pointers, etc. If you have two processes that run in separate address spaces accessing it, I don't see how that could work.

Upvotes: 1

Related Questions