libstdc++
__gnu_cxx::_Pointer_adapter< _Storage_policy > Class Template Reference

#include <pointer.h>

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

template<typename _Up >
 _Pointer_adapter (_Up *__arg)
 
 _Pointer_adapter (const _Pointer_adapter &__arg)
 
template<typename _Up >
 _Pointer_adapter (const _Pointer_adapter< _Up > &__arg)
 
 _Pointer_adapter (element_type *__arg=0)
 
 operator bool () const
 
reference operator* () const
 
_Pointer_adapteroperator++ ()
 
_Pointer_adapter operator++ (int)
 
_Pointer_adapteroperator+= (int __offset)
 
_Pointer_adapteroperator+= (long __offset)
 
_Pointer_adapteroperator+= (long long __offset)
 
_Pointer_adapteroperator+= (short __offset)
 
_Pointer_adapteroperator+= (unsigned int __offset)
 
_Pointer_adapteroperator+= (unsigned long __offset)
 
_Pointer_adapteroperator+= (unsigned long long __offset)
 
_Pointer_adapteroperator+= (unsigned short __offset)
 
template<typename _Up >
std::ptrdiff_t operator- (const _Pointer_adapter< _Up > &__rhs) const
 
_Pointer_adapteroperator-- ()
 
_Pointer_adapter operator-- (int)
 
_Pointer_adapteroperator-= (int __offset)
 
_Pointer_adapteroperator-= (long __offset)
 
_Pointer_adapteroperator-= (long long __offset)
 
_Pointer_adapteroperator-= (short __offset)
 
_Pointer_adapteroperator-= (unsigned int __offset)
 
_Pointer_adapteroperator-= (unsigned long __offset)
 
_Pointer_adapteroperator-= (unsigned long long __offset)
 
_Pointer_adapteroperator-= (unsigned short __offset)
 
element_type * operator-> () const
 
template<typename _Up >
_Pointer_adapteroperator= (_Up *__arg)
 
_Pointer_adapteroperator= (const _Pointer_adapter &__arg)
 
template<typename _Up >
_Pointer_adapteroperator= (const _Pointer_adapter< _Up > &__arg)
 
reference operator[] (std::ptrdiff_t __index) const
 

Friends

_Pointer_adapter operator+ (const _Pointer_adapter &__lhs, int __offset)
 
_Pointer_adapter operator+ (const _Pointer_adapter &__lhs, long __offset)
 
_Pointer_adapter operator+ (const _Pointer_adapter &__lhs, long long __offset)
 
_Pointer_adapter operator+ (const _Pointer_adapter &__lhs, short __offset)
 
_Pointer_adapter operator+ (const _Pointer_adapter &__lhs, unsigned int __offset)
 
_Pointer_adapter operator+ (const _Pointer_adapter &__lhs, unsigned long __offset)
 
_Pointer_adapter operator+ (const _Pointer_adapter &__lhs, unsigned long long __offset)
 
_Pointer_adapter operator+ (const _Pointer_adapter &__lhs, unsigned short __offset)
 
_Pointer_adapter operator+ (int __offset, const _Pointer_adapter &__rhs)
 
_Pointer_adapter operator+ (long __offset, const _Pointer_adapter &__rhs)
 
_Pointer_adapter operator+ (long long __offset, const _Pointer_adapter &__rhs)
 
_Pointer_adapter operator+ (short __offset, const _Pointer_adapter &__rhs)
 
_Pointer_adapter operator+ (unsigned int __offset, const _Pointer_adapter &__rhs)
 
_Pointer_adapter operator+ (unsigned long __offset, const _Pointer_adapter &__rhs)
 
_Pointer_adapter operator+ (unsigned long long __offset, const _Pointer_adapter &__rhs)
 
_Pointer_adapter operator+ (unsigned short __offset, const _Pointer_adapter &__rhs)
 
template<typename _Up >
std::ptrdiff_t operator- (_Up *__lhs, const _Pointer_adapter &__rhs)
 
template<typename _Up >
std::ptrdiff_t operator- (const _Pointer_adapter &__lhs, _Up *__rhs)
 
std::ptrdiff_t operator- (const _Pointer_adapter &__lhs, element_type *__rhs)
 
_Pointer_adapter operator- (const _Pointer_adapter &__lhs, int __offset)
 
_Pointer_adapter operator- (const _Pointer_adapter &__lhs, long __offset)
 
_Pointer_adapter operator- (const _Pointer_adapter &__lhs, long long __offset)
 
_Pointer_adapter operator- (const _Pointer_adapter &__lhs, short __offset)
 
_Pointer_adapter operator- (const _Pointer_adapter &__lhs, unsigned int __offset)
 
_Pointer_adapter operator- (const _Pointer_adapter &__lhs, unsigned long __offset)
 
_Pointer_adapter operator- (const _Pointer_adapter &__lhs, unsigned long long __offset)
 
_Pointer_adapter operator- (const _Pointer_adapter &__lhs, unsigned short __offset)
 
std::ptrdiff_t operator- (element_type *__lhs, const _Pointer_adapter &__rhs)
 

Detailed Description

template<typename _Storage_policy>
class __gnu_cxx::_Pointer_adapter< _Storage_policy >

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> >;

Definition at line 284 of file pointer.h.

Member Typedef Documentation

◆ difference_type

template<typename _Storage_policy >
typedef std::ptrdiff_t __gnu_cxx::_Pointer_adapter< _Storage_policy >::difference_type

Definition at line 292 of file pointer.h.

◆ element_type

template<typename _Storage_policy >
typedef _Storage_policy::element_type __gnu_cxx::_Pointer_adapter< _Storage_policy >::element_type

Definition at line 287 of file pointer.h.

◆ iterator_category

template<typename _Storage_policy >
typedef std::random_access_iterator_tag __gnu_cxx::_Pointer_adapter< _Storage_policy >::iterator_category

Definition at line 290 of file pointer.h.

◆ pointer

template<typename _Storage_policy >
typedef _Pointer_adapter __gnu_cxx::_Pointer_adapter< _Storage_policy >::pointer

Definition at line 293 of file pointer.h.

◆ reference

template<typename _Storage_policy >
typedef _Reference_type<element_type>::reference __gnu_cxx::_Pointer_adapter< _Storage_policy >::reference

Definition at line 294 of file pointer.h.

◆ value_type

template<typename _Storage_policy >
typedef _Unqualified_type<element_type>::type __gnu_cxx::_Pointer_adapter< _Storage_policy >::value_type

Definition at line 291 of file pointer.h.

Constructor & Destructor Documentation

◆ _Pointer_adapter() [1/4]

template<typename _Storage_policy >
__gnu_cxx::_Pointer_adapter< _Storage_policy >::_Pointer_adapter ( element_type *  __arg = 0)
inline

Definition at line 301 of file pointer.h.

◆ _Pointer_adapter() [2/4]

template<typename _Storage_policy >
__gnu_cxx::_Pointer_adapter< _Storage_policy >::_Pointer_adapter ( const _Pointer_adapter< _Storage_policy > &  __arg)
inline

Definition at line 305 of file pointer.h.

◆ _Pointer_adapter() [3/4]

template<typename _Storage_policy >
template<typename _Up >
__gnu_cxx::_Pointer_adapter< _Storage_policy >::_Pointer_adapter ( _Up *  __arg)
inline

Definition at line 310 of file pointer.h.

◆ _Pointer_adapter() [4/4]

template<typename _Storage_policy >
template<typename _Up >
__gnu_cxx::_Pointer_adapter< _Storage_policy >::_Pointer_adapter ( const _Pointer_adapter< _Up > &  __arg)
inline

Definition at line 316 of file pointer.h.

◆ ~_Pointer_adapter()

template<typename _Storage_policy >
__gnu_cxx::_Pointer_adapter< _Storage_policy >::~_Pointer_adapter ( )
inline

Definition at line 320 of file pointer.h.

Member Function Documentation

◆ operator bool()

template<typename _Storage_policy >
__gnu_cxx::_Pointer_adapter< _Storage_policy >::operator bool ( ) const
inlineexplicit

Definition at line 363 of file pointer.h.

◆ operator*()

template<typename _Storage_policy >
reference __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator* ( ) const
inline

Definition at line 348 of file pointer.h.

◆ operator++() [1/2]

template<typename _Storage_policy >
_Pointer_adapter & __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator++ ( )
inline

Definition at line 454 of file pointer.h.

◆ operator++() [2/2]

template<typename _Storage_policy >
_Pointer_adapter __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator++ ( int  )
inline

Definition at line 461 of file pointer.h.

◆ operator+=() [1/8]

template<typename _Storage_policy >
_Pointer_adapter & __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator+= ( int  __offset)
inline

Definition at line 443 of file pointer.h.

◆ operator+=() [2/8]

template<typename _Storage_policy >
_Pointer_adapter & __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator+= ( long  __offset)
inline

Definition at line 445 of file pointer.h.

◆ operator+=() [3/8]

template<typename _Storage_policy >
_Pointer_adapter & __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator+= ( long long  __offset)
inline

Definition at line 448 of file pointer.h.

◆ operator+=() [4/8]

template<typename _Storage_policy >
_Pointer_adapter & __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator+= ( short  __offset)
inline

Definition at line 441 of file pointer.h.

◆ operator+=() [5/8]

template<typename _Storage_policy >
_Pointer_adapter & __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator+= ( unsigned int  __offset)
inline

Definition at line 444 of file pointer.h.

◆ operator+=() [6/8]

template<typename _Storage_policy >
_Pointer_adapter & __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator+= ( unsigned long  __offset)
inline

Definition at line 446 of file pointer.h.

◆ operator+=() [7/8]

template<typename _Storage_policy >
_Pointer_adapter & __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator+= ( unsigned long long  __offset)
inline

Definition at line 449 of file pointer.h.

◆ operator+=() [8/8]

template<typename _Storage_policy >
_Pointer_adapter & __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator+= ( unsigned short  __offset)
inline

Definition at line 442 of file pointer.h.

◆ operator-()

template<typename _Storage_policy >
template<typename _Up >
std::ptrdiff_t __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator- ( const _Pointer_adapter< _Up > &  __rhs) const
inline

Definition at line 402 of file pointer.h.

◆ operator--() [1/2]

template<typename _Storage_policy >
_Pointer_adapter & __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator-- ( )
inline

Definition at line 469 of file pointer.h.

◆ operator--() [2/2]

template<typename _Storage_policy >
_Pointer_adapter __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator-- ( int  )
inline

Definition at line 476 of file pointer.h.

◆ operator-=() [1/8]

template<typename _Storage_policy >
_Pointer_adapter & __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator-= ( int  __offset)
inline

Definition at line 443 of file pointer.h.

◆ operator-=() [2/8]

template<typename _Storage_policy >
_Pointer_adapter & __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator-= ( long  __offset)
inline

Definition at line 445 of file pointer.h.

◆ operator-=() [3/8]

template<typename _Storage_policy >
_Pointer_adapter & __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator-= ( long long  __offset)
inline

Definition at line 448 of file pointer.h.

◆ operator-=() [4/8]

template<typename _Storage_policy >
_Pointer_adapter & __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator-= ( short  __offset)
inline

Definition at line 441 of file pointer.h.

◆ operator-=() [5/8]

template<typename _Storage_policy >
_Pointer_adapter & __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator-= ( unsigned int  __offset)
inline

Definition at line 444 of file pointer.h.

◆ operator-=() [6/8]

template<typename _Storage_policy >
_Pointer_adapter & __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator-= ( unsigned long  __offset)
inline

Definition at line 446 of file pointer.h.

◆ operator-=() [7/8]

template<typename _Storage_policy >
_Pointer_adapter & __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator-= ( unsigned long long  __offset)
inline

Definition at line 449 of file pointer.h.

◆ operator-=() [8/8]

template<typename _Storage_policy >
_Pointer_adapter & __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator-= ( unsigned short  __offset)
inline

Definition at line 442 of file pointer.h.

◆ operator->()

template<typename _Storage_policy >
element_type * __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator-> ( ) const
inline

Definition at line 353 of file pointer.h.

◆ operator=() [1/3]

template<typename _Storage_policy >
template<typename _Up >
_Pointer_adapter & __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator= ( _Up *  __arg)
inline

Definition at line 340 of file pointer.h.

◆ operator=() [2/3]

template<typename _Storage_policy >
_Pointer_adapter & __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator= ( const _Pointer_adapter< _Storage_policy > &  __arg)
inline

Definition at line 324 of file pointer.h.

◆ operator=() [3/3]

template<typename _Storage_policy >
template<typename _Up >
_Pointer_adapter & __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator= ( const _Pointer_adapter< _Up > &  __arg)
inline

Definition at line 332 of file pointer.h.

◆ operator[]()

template<typename _Storage_policy >
reference __gnu_cxx::_Pointer_adapter< _Storage_policy >::operator[] ( std::ptrdiff_t  __index) const
inline

Definition at line 358 of file pointer.h.

Friends And Related Symbol Documentation

◆ operator+ [1/16]

template<typename _Storage_policy >
_Pointer_adapter operator+ ( const _Pointer_adapter< _Storage_policy > &  __lhs,
int  __offset 
)
friend

Definition at line 443 of file pointer.h.

◆ operator+ [2/16]

template<typename _Storage_policy >
_Pointer_adapter operator+ ( const _Pointer_adapter< _Storage_policy > &  __lhs,
long  __offset 
)
friend

Definition at line 445 of file pointer.h.

◆ operator+ [3/16]

template<typename _Storage_policy >
_Pointer_adapter operator+ ( const _Pointer_adapter< _Storage_policy > &  __lhs,
long long  __offset 
)
friend

Definition at line 448 of file pointer.h.

◆ operator+ [4/16]

template<typename _Storage_policy >
_Pointer_adapter operator+ ( const _Pointer_adapter< _Storage_policy > &  __lhs,
short  __offset 
)
friend

Definition at line 441 of file pointer.h.

◆ operator+ [5/16]

template<typename _Storage_policy >
_Pointer_adapter operator+ ( const _Pointer_adapter< _Storage_policy > &  __lhs,
unsigned int  __offset 
)
friend

Definition at line 444 of file pointer.h.

◆ operator+ [6/16]

template<typename _Storage_policy >
_Pointer_adapter operator+ ( const _Pointer_adapter< _Storage_policy > &  __lhs,
unsigned long  __offset 
)
friend

Definition at line 446 of file pointer.h.

◆ operator+ [7/16]

template<typename _Storage_policy >
_Pointer_adapter operator+ ( const _Pointer_adapter< _Storage_policy > &  __lhs,
unsigned long long  __offset 
)
friend

Definition at line 449 of file pointer.h.

◆ operator+ [8/16]

template<typename _Storage_policy >
_Pointer_adapter operator+ ( const _Pointer_adapter< _Storage_policy > &  __lhs,
unsigned short  __offset 
)
friend

Definition at line 442 of file pointer.h.

◆ operator+ [9/16]

template<typename _Storage_policy >
_Pointer_adapter operator+ ( int  __offset,
const _Pointer_adapter< _Storage_policy > &  __rhs 
)
friend

Definition at line 443 of file pointer.h.

◆ operator+ [10/16]

template<typename _Storage_policy >
_Pointer_adapter operator+ ( long  __offset,
const _Pointer_adapter< _Storage_policy > &  __rhs 
)
friend

Definition at line 445 of file pointer.h.

◆ operator+ [11/16]

template<typename _Storage_policy >
_Pointer_adapter operator+ ( long long  __offset,
const _Pointer_adapter< _Storage_policy > &  __rhs 
)
friend

Definition at line 448 of file pointer.h.

◆ operator+ [12/16]

template<typename _Storage_policy >
_Pointer_adapter operator+ ( short  __offset,
const _Pointer_adapter< _Storage_policy > &  __rhs 
)
friend

Definition at line 441 of file pointer.h.

◆ operator+ [13/16]

template<typename _Storage_policy >
_Pointer_adapter operator+ ( unsigned int  __offset,
const _Pointer_adapter< _Storage_policy > &  __rhs 
)
friend

Definition at line 444 of file pointer.h.

◆ operator+ [14/16]

template<typename _Storage_policy >
_Pointer_adapter operator+ ( unsigned long  __offset,
const _Pointer_adapter< _Storage_policy > &  __rhs 
)
friend

Definition at line 446 of file pointer.h.

◆ operator+ [15/16]

template<typename _Storage_policy >
_Pointer_adapter operator+ ( unsigned long long  __offset,
const _Pointer_adapter< _Storage_policy > &  __rhs 
)
friend

Definition at line 449 of file pointer.h.

◆ operator+ [16/16]

template<typename _Storage_policy >
_Pointer_adapter operator+ ( unsigned short  __offset,
const _Pointer_adapter< _Storage_policy > &  __rhs 
)
friend

Definition at line 442 of file pointer.h.

◆ operator- [1/12]

template<typename _Storage_policy >
template<typename _Up >
std::ptrdiff_t operator- ( _Up *  __lhs,
const _Pointer_adapter< _Storage_policy > &  __rhs 
)
friend

Definition at line 397 of file pointer.h.

◆ operator- [2/12]

template<typename _Storage_policy >
template<typename _Up >
std::ptrdiff_t operator- ( const _Pointer_adapter< _Storage_policy > &  __lhs,
_Up *  __rhs 
)
friend

Definition at line 392 of file pointer.h.

◆ operator- [3/12]

template<typename _Storage_policy >
std::ptrdiff_t operator- ( const _Pointer_adapter< _Storage_policy > &  __lhs,
element_type *  __rhs 
)
friend

Definition at line 383 of file pointer.h.

◆ operator- [4/12]

template<typename _Storage_policy >
_Pointer_adapter operator- ( const _Pointer_adapter< _Storage_policy > &  __lhs,
int  __offset 
)
friend

Definition at line 443 of file pointer.h.

◆ operator- [5/12]

template<typename _Storage_policy >
_Pointer_adapter operator- ( const _Pointer_adapter< _Storage_policy > &  __lhs,
long  __offset 
)
friend

Definition at line 445 of file pointer.h.

◆ operator- [6/12]

template<typename _Storage_policy >
_Pointer_adapter operator- ( const _Pointer_adapter< _Storage_policy > &  __lhs,
long long  __offset 
)
friend

Definition at line 448 of file pointer.h.

◆ operator- [7/12]

template<typename _Storage_policy >
_Pointer_adapter operator- ( const _Pointer_adapter< _Storage_policy > &  __lhs,
short  __offset 
)
friend

Definition at line 441 of file pointer.h.

◆ operator- [8/12]

template<typename _Storage_policy >
_Pointer_adapter operator- ( const _Pointer_adapter< _Storage_policy > &  __lhs,
unsigned int  __offset 
)
friend

Definition at line 444 of file pointer.h.

◆ operator- [9/12]

template<typename _Storage_policy >
_Pointer_adapter operator- ( const _Pointer_adapter< _Storage_policy > &  __lhs,
unsigned long  __offset 
)
friend

Definition at line 446 of file pointer.h.

◆ operator- [10/12]

template<typename _Storage_policy >
_Pointer_adapter operator- ( const _Pointer_adapter< _Storage_policy > &  __lhs,
unsigned long long  __offset 
)
friend

Definition at line 449 of file pointer.h.

◆ operator- [11/12]

template<typename _Storage_policy >
_Pointer_adapter operator- ( const _Pointer_adapter< _Storage_policy > &  __lhs,
unsigned short  __offset 
)
friend

Definition at line 442 of file pointer.h.

◆ operator- [12/12]

template<typename _Storage_policy >
std::ptrdiff_t operator- ( element_type *  __lhs,
const _Pointer_adapter< _Storage_policy > &  __rhs 
)
friend

Definition at line 387 of file pointer.h.


The documentation for this class was generated from the following file: