A smart pointer that stores the offset between between the pointer and the the object it points.
More...
|
| offset_ptr () |
| Default constructor (null pointer). More...
|
|
| offset_ptr (pointer ptr) |
| Constructor from raw pointer (allows "0" pointer conversion). More...
|
|
template<class T > |
| offset_ptr (T *ptr, typename ipcdetail::enable_if< ipcdetail::is_convertible< T *, PointedType * > >::type *=0) |
| Constructor from other pointer. More...
|
|
| offset_ptr (const offset_ptr &ptr) |
| Constructor from other offset_ptr Never throws. More...
|
|
template<class T2 > |
| offset_ptr (const offset_ptr< T2, DifferenceType, OffsetType, OffsetAlignment > &ptr, typename ipcdetail::enable_if_c< ipcdetail::is_convertible< T2 *, PointedType * >::value &&ipcdetail::offset_ptr_maintains_address< T2, PointedType >::value >::type *=0) |
| Constructor from other offset_ptr. More...
|
|
template<class T2 > |
| offset_ptr (const offset_ptr< T2, DifferenceType, OffsetType, OffsetAlignment > &ptr, typename ipcdetail::enable_if_c< ipcdetail::is_convertible< T2 *, PointedType * >::value &&!ipcdetail::offset_ptr_maintains_address< T2, PointedType >::value >::type *=0) |
| Constructor from other offset_ptr. More...
|
|
template<class T2 , class P2 , class O2 , std::size_t A2> |
| offset_ptr (const offset_ptr< T2, P2, O2, A2 > &r, ipcdetail::static_cast_tag) |
| Emulates static_cast operator. More...
|
|
template<class T2 , class P2 , class O2 , std::size_t A2> |
| offset_ptr (const offset_ptr< T2, P2, O2, A2 > &r, ipcdetail::const_cast_tag) |
| Emulates const_cast operator. More...
|
|
template<class T2 , class P2 , class O2 , std::size_t A2> |
| offset_ptr (const offset_ptr< T2, P2, O2, A2 > &r, ipcdetail::dynamic_cast_tag) |
| Emulates dynamic_cast operator. More...
|
|
template<class T2 , class P2 , class O2 , std::size_t A2> |
| offset_ptr (const offset_ptr< T2, P2, O2, A2 > &r, ipcdetail::reinterpret_cast_tag) |
| Emulates reinterpret_cast operator. More...
|
|
pointer | get () const |
| Obtains raw pointer from offset. More...
|
|
offset_type | get_offset () const |
|
pointer | operator-> () const |
| Pointer-like -> operator. More...
|
|
reference | operator* () const |
| Dereferencing operator, if it is a null offset_ptr behavior is undefined. More...
|
|
reference | operator[] (difference_type idx) const |
| Indexing operator. More...
|
|
offset_ptr & | operator= (pointer from) |
| Assignment from pointer (saves extra conversion). More...
|
|
offset_ptr & | operator= (const offset_ptr &ptr) |
| Assignment from other offset_ptr. More...
|
|
template<class T2 > |
ipcdetail::enable_if_c
< ipcdetail::is_convertible
< T2 *, PointedType * >::value
&&ipcdetail::offset_ptr_maintains_address
< T2, PointedType >::value,
offset_ptr & >::type | operator= (const offset_ptr< T2, DifferenceType, OffsetType, OffsetAlignment > &ptr) |
| Assignment from related offset_ptr. More...
|
|
template<class T2 > |
ipcdetail::enable_if_c
< ipcdetail::is_convertible
< T2 *, PointedType * >::value
&&!ipcdetail::offset_ptr_maintains_address
< T2, PointedType >::value,
offset_ptr & >::type | operator= (const offset_ptr< T2, DifferenceType, OffsetType, OffsetAlignment > &ptr) |
|
offset_ptr & | operator+= (difference_type offset) |
| offset_ptr += difference_type. More...
|
|
offset_ptr & | operator-= (difference_type offset) |
| offset_ptr -= difference_type. More...
|
|
offset_ptr & | operator++ (void) |
| ++offset_ptr. More...
|
|
offset_ptr | operator++ (int) |
| offset_ptr++. More...
|
|
offset_ptr & | operator-- (void) |
| –offset_ptr. More...
|
|
offset_ptr | operator-- (int) |
| offset_ptr–. More...
|
|
| operator unspecified_bool_type () const |
| safe bool conversion operator. More...
|
|
bool | operator! () const |
| Not operator. More...
|
|
|
offset_ptr | operator+ (difference_type diff, offset_ptr right) |
| difference_type + offset_ptr operation More...
|
|
offset_ptr | operator+ (offset_ptr left, difference_type diff) |
| offset_ptr + difference_type operation More...
|
|
offset_ptr | operator- (offset_ptr left, difference_type diff) |
| offset_ptr - diff operation More...
|
|
offset_ptr | operator- (difference_type diff, offset_ptr right) |
| offset_ptr - diff operation More...
|
|
difference_type | operator- (const offset_ptr &pt, const offset_ptr &pt2) |
| offset_ptr - offset_ptr operation More...
|
|
bool | operator== (const offset_ptr &pt1, const offset_ptr &pt2) |
|
bool | operator!= (const offset_ptr &pt1, const offset_ptr &pt2) |
|
bool | operator< (const offset_ptr &pt1, const offset_ptr &pt2) |
|
bool | operator<= (const offset_ptr &pt1, const offset_ptr &pt2) |
|
bool | operator> (const offset_ptr &pt1, const offset_ptr &pt2) |
|
bool | operator>= (const offset_ptr &pt1, const offset_ptr &pt2) |
|
bool | operator== (pointer pt1, const offset_ptr &pt2) |
|
bool | operator!= (pointer pt1, const offset_ptr &pt2) |
|
bool | operator< (pointer pt1, const offset_ptr &pt2) |
|
bool | operator<= (pointer pt1, const offset_ptr &pt2) |
|
bool | operator> (pointer pt1, const offset_ptr &pt2) |
|
bool | operator>= (pointer pt1, const offset_ptr &pt2) |
|
bool | operator== (const offset_ptr &pt1, pointer pt2) |
|
bool | operator!= (const offset_ptr &pt1, pointer pt2) |
|
bool | operator< (const offset_ptr &pt1, pointer pt2) |
|
bool | operator<= (const offset_ptr &pt1, pointer pt2) |
|
bool | operator> (const offset_ptr &pt1, pointer pt2) |
|
bool | operator>= (const offset_ptr &pt1, pointer pt2) |
|
void | swap (offset_ptr &left, offset_ptr &right) |
|
template<class PointedType, class DifferenceType, class OffsetType, std::size_t OffsetAlignment>
class boost::interprocess::offset_ptr< PointedType, DifferenceType, OffsetType, OffsetAlignment >
A smart pointer that stores the offset between between the pointer and the the object it points.
This allows offset allows special properties, since the pointer is independent from the address address of the pointee, if the pointer and the pointee are still separated by the same offset. This feature converts offset_ptr in a smart pointer that can be placed in shared memory and memory mapped files mapped in different addresses in every process.
- Template Parameters
-
PointedType | The type of the pointee. |
DifferenceType | A signed integer type that can represent the arithmetic operations on the pointer |
OffsetType | An unsigned integer type that can represent the distance between two pointers reinterpret_cast-ed as unsigned integers. In general this type should be at least of the same size of std::uintptr_t. In some systems it's possible to communicate between 32 and 64 bit processes using 64 bit offsets. |
OffsetAlignment | Alignment of the OffsetType stored inside. In some systems might be necessary to align it to 64 bits in order to communicate 32 and 64 bit processes using 64 bit offsets. |