简体   繁体   English

共享内存中的std :: string数组。

[英]array of std::string in shared memory.

I wonder how visual c++ std::string is populated in memory. 我不知道视觉c ++ std :: string如何填充在内存中。
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 ? 例如,如果我在共享内存区域中声明了std::string container[10] ,那么我可以在运行时将任意长度的字符串插入此数组吗?
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 ? 既然已知共享内存区域无法在运行时扩展,那么我们如何才能将不同大小的字符串插入此数组中?

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. std :: string涉及动态内存分配,指针等。如果您有两个在单独的地址空间中运行的进程对其进行访问,则看不到它如何工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM