19 Jun
2013
19 Jun
'13
8:05 p.m.
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<named_mutex> lock(*m_mutex); MyShmString inStr(in.c_str(), charallocator); sharedSegmentVector->push_back(inStr); } Best, Ion