相关疑难解决方法(0)

映射在共享内存中

我想在共享内存中创建一个unordered_map.我正在使用allocator来达到目的.

代码

void *addr;
void *pool;
int shmid;

template<class T>
class MyPoolAlloc {
private:
public:
    typedef size_t     size_type;
    typedef ptrdiff_t  difference_type;
    typedef T*         pointer;
    typedef const T*   const_pointer;
    typedef T&         reference;
    typedef const T&   const_reference;
    typedef T          value_type;

   template<class X>
   struct rebind
   { typedef MyPoolAlloc<X> other; };

   MyPoolAlloc() throw() {
   }
   MyPoolAlloc(const MyPoolAlloc&) throw()  {
   }

   template<class X>
   MyPoolAlloc(const MyPoolAlloc<X>&) throw() {
   }

   ~MyPoolAlloc() throw() {
   }

  pointer address(reference __x) const { return &__x; }

  const_pointer address(const_reference __x) const { …
Run Code Online (Sandbox Code Playgroud)

c++ shared-memory

7
推荐指数
1
解决办法
4426
查看次数

标签 统计

c++ ×1

shared-memory ×1