Question on boost shared memory allocators

Da Xu via Boost-users <[email protected]>
Newsgroups gmane.comp.lib.boost.user
Message-ID <[email protected]>
Hi folks, 

got a couple of questions about using shared memory allocators. Please see below.

I have the following code
template <typename T> using CAP_Alloc = cached_adaptive_pool<T, segment_manager_t>; using CAP_Shmem_String = basic_string<char, std::char_traits<char>, CAP_Alloc<char> >;
using CAP_Shmem_String_Alloc = CAP_Alloc<CAP_Shmem_String>;
using CAP_Shmem_Void_Alloc = CAP_Alloc<void>;

class MyDataBlock{
    using pointer = CAP_Shmem_String_Alloc::pointer;
    pointer strData;    float extraData;
    MyDataBlock(): strData(nullptr), extraData(0.0) {}    MyDataBlock(const CAP_Shmem_Void_Alloc& alloc)    {        /*        My question is how do I convert CAP_Shmem_Void_Alloc to type CAP_Shmem_String_Alloc to call allocate? And do I pass in the void allocator as a construction argument? Is there a difference between allocate and construct?

        */
    }
    ~MyDataBlock()    {        /*        To delete the memory, do I need to keep around a copy of the original allocator, so I can call deallocate or destroy? Or can that be derived or converted from somewhere, like calling strData->alloc() ? 
    
        */
    }

}
Any help would be greatly appreciated.
Thank you. 

_______________________________________________
Boost-users mailing list
[email protected]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.