Mutex synchronised wrapper class for boost::interprocess shared memory vector of strings

I'm trying to write a wrapper class in C++ to give mutex synchronised
interprocess access to a shared memory vector of strings. This is my first
foray into boost::interprocess and allocators are proving something of a
mystery.
Is anyone able to see why on compilation I get the error:
error C2512: 'boost::interprocess::allocator::allocator' : no appropriate
default constructor available C:\Program Files
(x86)\Boost\boost_1_53_0\boost\container\string.hpp
#ifndef SHARED_MEMORY_WRAPPER_H//if not defined already
#define SHARED_MEMORY_WRAPPER_H//then define it
#include

El 18/06/2013 16:28, Riskybiz escribió:
I'm trying to write a wrapper class in C++ to give mutex synchronised interprocess access to a shared memory vector of strings. This is my first foray into boost::interprocess and allocators are proving something of a mystery.
Is anyone able to see why on compilation I get the error:
When you build any container in shared memory it must be constructed
with an allocator. Change your push function to (not charallocator is
passed to MyShmString):
void push(const std::string & in)
{
CharAllocator charallocator(m_segment->get_segment_manager());
scoped_lock
participants (2)
-
Ion Gaztañaga
-
Riskybiz