Boost logo

Boost Users :

Subject: [Boost-users] Problem creating a circular buffer in shared memory using Boost
From: Cuneyt Taskiran (ctaskiran_at_[hidden])
Date: 2010-02-24 23:50:27


Hi,

I am trying to create a circular buffer in shared memory using
Boost circular_buffer and Interprocess libraries. I compiled and ran the the
example given in the Interprocess
documentation<http://www.boost.org/doc/libs/1_42_0/doc/html/interprocess/quick_guide.html#interprocess.quick_guide.qg_interprocess_container>for
creating a vector in shared memory with no problem. However, when I
modify it to use the Boost circular_buffer as:
int main(int argc, char *argv[])
{
    managed_shared_memory segment(create_only, "MySharedMemory", 65536);
    const ShmemAllocator alloc_inst (segment.get_segment_manager());
    MyCircBuffer *myCircBuf =
segment.construct<MyCircBuffer>("MyCircBuffer")(alloc_inst);
    return 0;
}

I get a compilation error (caused by segment.construct()). Any idea what I
am doing wrong? Is it because circular_buffer is not one of the containers
listed in /boost/interprocess/containers, i.e. it's not compatible with
Interprocess?

Thanks,

C



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net