Boost logo

Boost Users :

Subject: [Boost-users] Newbie error trying to construct an offset_ptr in a managed shared memory segment.
From: Bill Baker (bb_at_[hidden])
Date: 2019-04-03 14:38:12

This must be really dumb, because I can't even get the code to compile. I'm using VS2017 Pro and Boost 1.69.0.

The lines of code I'm having trouble with read:
_dataBuffer = _sharedMemorySegment.construct<byte>(DataBufferName)[DataBufferSize](0);
_dataBufferFree = _sharedMemorySegment.construct<size_t>(DataBufferFreeName)(DataBufferSize);
_dataBufferInPointer = _sharedMemorySegment.construct<byte_offset_t >(DataBufferInName)(0);

I get the following error referencing the last line:
Severity Code Description Project File Line Suppression State
Error C2664 'boost::interprocess::offset_ptr<byte,ptrdiff_t,uintptr_t,0>::offset_ptr(const boost::interprocess::offset_ptr<byte,ptrdiff_t,uintptr_t,0> &) noexcept': cannot convert argument 1 from 'T' to 'unsigned char *' EncodingService c:\program files\boost\boost_1_67_0\boost_1_69_0\boost\interprocess\detail\named_proxy.hpp 85

Any help would be greatly appreciated!


Bill Baker

Nordic Backup, Inc.
600 Rinehart Road, Suite 3050

Lake Mary, FL 32746
P: +1.888.668.0447


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at