libstdc++
|
Inherits _Storage_policy.
Public Types | |
typedef std::ptrdiff_t | difference_type |
typedef _Storage_policy::element_type | element_type |
typedef std::random_access_iterator_tag | iterator_category |
typedef _Pointer_adapter | pointer |
typedef _Reference_type< element_type >::reference | reference |
typedef _Unqualified_type< element_type >::type | value_type |
Public Member Functions | |
_Pointer_adapter (element_type *__arg=0) | |
_Pointer_adapter (const _Pointer_adapter &__arg) | |
template<typename _Up > | |
_Pointer_adapter (_Up *__arg) | |
template<typename _Up > | |
_Pointer_adapter (const _Pointer_adapter< _Up > &__arg) | |
operator __unspecified_bool_type () const | |
bool | operator! () const |
reference | operator* () const |
_Pointer_adapter & | operator++ () |
_Pointer_adapter | operator++ (int) |
_Pointer_adapter & | operator+= (short __offset) |
_Pointer_adapter & | operator+= (unsigned short __offset) |
_Pointer_adapter & | operator+= (int __offset) |
_Pointer_adapter & | operator+= (unsigned int __offset) |
_Pointer_adapter & | operator+= (long __offset) |
_Pointer_adapter & | operator+= (unsigned long __offset) |
template<typename _Up > | |
std::ptrdiff_t | operator- (const _Pointer_adapter< _Up > &__rhs) const |
_Pointer_adapter & | operator-- () |
_Pointer_adapter | operator-- (int) |
_Pointer_adapter & | operator-= (short __offset) |
_Pointer_adapter & | operator-= (unsigned short __offset) |
_Pointer_adapter & | operator-= (int __offset) |
_Pointer_adapter & | operator-= (unsigned int __offset) |
_Pointer_adapter & | operator-= (long __offset) |
_Pointer_adapter & | operator-= (unsigned long __offset) |
element_type * | operator-> () const |
_Pointer_adapter & | operator= (const _Pointer_adapter &__arg) |
template<typename _Up > | |
_Pointer_adapter & | operator= (const _Pointer_adapter< _Up > &__arg) |
template<typename _Up > | |
_Pointer_adapter & | operator= (_Up *__arg) |
reference | operator[] (std::ptrdiff_t __index) const |
Friends | |
_Pointer_adapter | operator+ (const _Pointer_adapter &__lhs, short __offset) |
_Pointer_adapter | operator+ (short __offset, const _Pointer_adapter &__rhs) |
_Pointer_adapter | operator+ (const _Pointer_adapter &__lhs, unsigned short __offset) |
_Pointer_adapter | operator+ (unsigned short __offset, const _Pointer_adapter &__rhs) |
_Pointer_adapter | operator+ (const _Pointer_adapter &__lhs, int __offset) |
_Pointer_adapter | operator+ (int __offset, const _Pointer_adapter &__rhs) |
_Pointer_adapter | operator+ (const _Pointer_adapter &__lhs, unsigned int __offset) |
_Pointer_adapter | operator+ (unsigned int __offset, const _Pointer_adapter &__rhs) |
_Pointer_adapter | operator+ (const _Pointer_adapter &__lhs, long __offset) |
_Pointer_adapter | operator+ (long __offset, const _Pointer_adapter &__rhs) |
_Pointer_adapter | operator+ (unsigned long __offset, const _Pointer_adapter &__rhs) |
_Pointer_adapter | operator+ (const _Pointer_adapter &__lhs, unsigned long __offset) |
std::ptrdiff_t | operator- (const _Pointer_adapter &__lhs, element_type *__rhs) |
std::ptrdiff_t | operator- (element_type *__lhs, const _Pointer_adapter &__rhs) |
template<typename _Up > | |
std::ptrdiff_t | operator- (const _Pointer_adapter &__lhs, _Up *__rhs) |
template<typename _Up > | |
std::ptrdiff_t | operator- (_Up *__lhs, const _Pointer_adapter &__rhs) |
_Pointer_adapter | operator- (const _Pointer_adapter &__lhs, short __offset) |
_Pointer_adapter | operator- (const _Pointer_adapter &__lhs, unsigned short __offset) |
_Pointer_adapter | operator- (const _Pointer_adapter &__lhs, int __offset) |
_Pointer_adapter | operator- (const _Pointer_adapter &__lhs, unsigned int __offset) |
_Pointer_adapter | operator- (const _Pointer_adapter &__lhs, long __offset) |
_Pointer_adapter | operator- (const _Pointer_adapter &__lhs, unsigned long __offset) |
The following provides an 'alternative pointer' that works with the containers when specified as the pointer typedef of the allocator.
The pointer type used with the containers doesn't have to be this class, but it must support the implicit conversions, pointer arithmetic, comparison operators, etc. that are supported by this class, and avoid raising compile-time ambiguities. Because creating a working pointer can be challenging, this pointer template was designed to wrapper an easier storage policy type, so that it becomes reusable for creating other pointer types.
A key point of this class is also that it allows container writers to 'assume' Allocator::pointer is a typedef for a normal pointer. This class supports most of the conventions of a true pointer, and can, for instance handle implicit conversion to const and base class pointer types. The only impositions on container writers to support extended pointers are: 1) use the Allocator::pointer typedef appropriately for pointer types. 2) if you need pointer casting, use the __pointer_cast<> functions from ext/cast.h. This allows pointer cast operations to be overloaded as necessary by custom pointers.
Note: The const qualifier works with this pointer adapter as follows:
_Tp* == _Pointer_adapter<_Std_pointer_impl<_Tp> >; const _Tp* == _Pointer_adapter<_Std_pointer_impl<const _Tp> >; _Tp* const == const _Pointer_adapter<_Std_pointer_impl<_Tp> >; const _Tp* const == const _Pointer_adapter<_Std_pointer_impl<const _Tp> >;