Boost logo

Boost Users :

Subject: [Boost-users] Interprocess : offset_ptr used as array
From: Oodini (svdbg____at_[hidden])
Date: 2013-05-16 07:44:54


Hello,

I have an offset_ptr named tmpData defined like this :

offset_ptr<const byte>* someVariable;
indextype index;
...
offset_ptr<const byte> tmpData = ((offset_ptr<const byte>*)someVariable)[index];

data points actually to the beginning of an array.
The original code, without shared memory was :

byte* data= ((byte**)m_someVariable)[index];

The problem is that I have to translate that :

indextype* data = (indextype*)&(tmpData[1]);

The adress of the second element is taken though the & adress.
But when tmpData is an offset_ptr, the [] operator returns a reference, and I can apply the & operator.

Is there any solution that copying the pointer to temporary variable, and increment this one ?

Thanks.


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