![]() |
Home | Libraries | People | FAQ | More |
boost::interprocess::offset_ptr
// In header: <boost/interprocess/offset_ptr.hpp> template<typename PointedType, typename DifferenceType, typename OffsetType, OffsetAlignment> class offset_ptr { public: // types typedef ; typedef ; typedef ; typedef ; typedef ; typedef ; typedef ; typedef offset_ptr< ; // construct/copy/destruct () ; () ; template<typename T> (, = ) ; (offset_ptr &) ; template<typename T2> (offset_ptr< ) ; template<typename T2> (offset_ptr< ) ; template<typename T2, typename P2, typename O2, A2> (offset_ptr< , ) ; template<typename T2, typename P2, typename O2, A2> (offset_ptr< , ) ; template<typename T2, typename P2, typename O2, A2> (offset_ptr< , ) ; template<typename T2, typename P2, typename O2, A2> (offset_ptr< , ) ; offset_ptr & () ; offset_ptr & (offset_ptr &) ; template<typename T2> offset_ptr & (offset_ptr< ) ; // public member functions () ; () ; () ; () ; () ; offset_ptr & () ; offset_ptr & () ; offset_ptr & () ; offset_ptr () ; offset_ptr & () ; offset_ptr () ; () ; () ; // public static functions offset_ptr () ; // friend functions offset_ptr (, offset_ptr) ; offset_ptr (offset_ptr, ) ; offset_ptr (offset_ptr, ) ; offset_ptr (, offset_ptr) ; (offset_ptr &, offset_ptr &) ; // private member functions template<typename T2> (offset_ptr< , ) ; template<typename T2> (offset_ptr< , ) ; };
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 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.
b>Note: offset_ptr uses implementation defined properties, present in most platforms, for performance reasons:
Assumes that OffsetType representation of nullptr is (OffsetType)zero.
Assumes that incrementing a OffsetType obtained from a pointer is equivalent to incrementing the pointer and then converting it back to OffsetType.
typename PointedType
The type of the pointee.
typename DifferenceType
A signed integer type that can represent the arithmetic operations on the pointer
typename OffsetType
An unsigned integer type that can represent the distance between two pointers reinterpret_cast-ed as unsigned integers. 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.
offset_ptr
public
construct/copy/destruct() ;
Default constructor (null pointer). Never throws.
( ptr) ;
Constructor from raw pointer (allows "0" pointer conversion). Never throws.
template<typename T> ( ptr, = ) ;
Constructor from other pointer. Never throws.
(offset_ptr & ptr) ;
Constructor from other offset_ptr
Never throws.
template<typename T2> (offset_ptr< ptr) ;
Constructor from other offset_ptr
. Only takes part in overload resolution if T2* is convertible to PointedType*. Never throws.
template<typename T2> (offset_ptr< ptr) ;
Constructor from other offset_ptr
. Only takes part in overload resolution if PointedType* is constructible from T2* other than via a conversion (e.g. cast to a derived class). Never throws.
template<typename T2, typename P2, typename O2, A2> (offset_ptr< r, ) ;
Emulates static_cast operator. Never throws.
template<typename T2, typename P2, typename O2, A2> (offset_ptr< r, ) ;
Emulates const_cast operator. Never throws.
template<typename T2, typename P2, typename O2, A2> (offset_ptr< r, ) ;
Emulates dynamic_cast operator. Never throws.
template<typename T2, typename P2, typename O2, A2> (offset_ptr< r, ) ;
Emulates reinterpret_cast operator. Never throws.
offset_ptr & ( from) ;
Assignment from pointer (saves extra conversion). Never throws.
offset_ptr & (offset_ptr & ptr) ;
Assignment from other offset_ptr
. Never throws.
template<typename T2> offset_ptr & (offset_ptr< ptr) ;
Assignment from related offset_ptr
. If pointers of pointee types are assignable, offset_ptrs will be assignable. Never throws.
offset_ptr
public member functions() ;
Obtains raw pointer from offset. Never throws.
() ;
() ;
Pointer-like -> operator. It can return 0 pointer. Never throws.
() ;
Dereferencing operator, if it is a null offset_ptr
behavior is undefined. Never throws.
( idx) ;
Indexing operator. Never throws.
offset_ptr & ( offset) ;
offset_ptr
+= difference_type. Never throws.
offset_ptr & ( offset) ;
offset_ptr
-= difference_type. Never throws.
offset_ptr & () ;
++offset_ptr
. Never throws.
offset_ptr () ;
offset_ptr++. Never throws.
offset_ptr & () ;
–offset_ptr
. Never throws.
offset_ptr () ;
offset_ptr
–. Never throws.
() ;
safe bool conversion operator. Never throws.
() ;
Not operator. Not needed in theory, but improves portability. Never throws
offset_ptr
friend functionsoffset_ptr ( diff, offset_ptr right) ;
difference_type + offset_ptr
operation
offset_ptr (offset_ptr left, diff) ;
offset_ptr
+ difference_type operation
offset_ptr (offset_ptr left, diff) ;
offset_ptr
- diff operation
offset_ptr ( diff, offset_ptr right) ;
offset_ptr
- diff operation
(offset_ptr & pt, offset_ptr & pt2) ;
offset_ptr
- offset_ptr
operation
offset_ptr
private member functionstemplate<typename T2> (offset_ptr< ptr, ) ;
template<typename T2> (offset_ptr< ptr, ) ;