I am trying to build a piece of code in VS 2010 that is commonly found online as an example of having a map in shared memory.
#include <boost\interprocess\managed_shared_memory.hpp>
#include <boost\interprocess\containers\map.hpp>
typedef boost::interprocess::map<long,long,
std::less<long>,
boost::interprocess::allocator<std::pair<long,long>,
boost::interprocess::managed_shared_memory::segment_manager> >
shmap;
boost::interprocess::managed_shared_memory segment1(
boost::interprocess::create_only,
"MySharedMemory", 655360); //segment name and size in bytes
shmap *rp = segment1.construct<shmap>("SharedMap")(
std::less<long>(), segment1.get_segment_manager());
I get this error which boggles my mind. Any ideas?
error C2338: (container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value)
Should be
typedef boost::interprocess::map
<long,long,std::less<long>,
boost::interprocess::allocator<std::pair<const long,long>,
boost::interprocess::managed_shared_memory::segment_manager> > shmap;
Since internal check is is_same<std::pair<const Key, T>, Allocator::value_type>