类型:
namespace bipc = boost::interprocess;
typedef bipc::allocator<char, bipc::managed_shared_memory::segment_manager> char_allocator;
typedef bipc::basic_string<char, std::char_traits<char>, char_allocator> shmem_string;
typedef bipc::allocator<shmem_string, bipc::managed_shared_memory::segment_manager> string_allocator;
typedef bipc::vector<shmem_string, string_allocator> shmem_vector;
当前使用情况:
le_buffer = shmem.construct<shmem_vector>("le_buffer")(some_string_allocator);
le_buffer->push_back(some_shmem_string);
麻烦:
现在我需要遍历这个向量并删除所有解析为 int 等于 123 的字符串。
int size = le_buffer->size();
for(int i=0; i<size; i++){
int tmp = parse(le_buffer->at(i));
if(tmp == 123) {
// ???
}
}
如何安全地删除这些字符串le_buffer
?