ProxyAlloc

释义

PropxyAlloc,顾名思义,是一个Allocator代理。

规格

template <class AllocT>
class ProxyAlloc
{
private:
    AllocT* m_alloc;
 
public:
    ProxyAlloc(AllocT& alloc) : m_alloc(&alloc) {}
 
public:
    void* allocate(size_t cb)  { return m_alloc->allocate(cb); }
    void deallocate(void* p)   { m_alloc->deallocate(p); }
    void swap(ProxyAlloc& o)   { std::swap(m_alloc, o.m_alloc); }
};

AllocT

相关参考

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License