PPL  1.2
Parma_Polyhedra_Library::Implementation::Ptr_Iterator< P > Class Template Reference

A class to define STL const and non-const iterators from pointer types. More...

#include <Ptr_Iterator_defs.hh>

Inheritance diagram for Parma_Polyhedra_Library::Implementation::Ptr_Iterator< P >:
Collaboration diagram for Parma_Polyhedra_Library::Implementation::Ptr_Iterator< P >:

Public Types

typedef std::iterator_traits< P >::difference_type difference_type
 
typedef std::iterator_traits< P >::reference reference
 
typedef std::iterator_traits< P >::pointer pointer
 

Public Member Functions

 Ptr_Iterator ()
 Default constructor: no guarantees. More...
 
 Ptr_Iterator (const P &q)
 Construct an iterator pointing at q. More...
 
template<typename Q >
 Ptr_Iterator (const Ptr_Iterator< Q > &q)
 Copy constructor allowing the construction of a const_iterator from a non-const iterator. More...
 
reference operator* () const
 Dereference operator. More...
 
pointer operator-> () const
 Indirect member selector. More...
 
reference operator[] (const difference_type m) const
 Subscript operator. More...
 
Ptr_Iteratoroperator++ ()
 Prefix increment operator. More...
 
Ptr_Iterator operator++ (int)
 Postfix increment operator. More...
 
Ptr_Iteratoroperator-- ()
 Prefix decrement operator. More...
 
Ptr_Iterator operator-- (int)
 Postfix decrement operator. More...
 
Ptr_Iteratoroperator+= (const difference_type m)
 Assignment-increment operator. More...
 
Ptr_Iteratoroperator-= (const difference_type m)
 Assignment-decrement operator. More...
 
difference_type operator- (const Ptr_Iterator &y) const
 Returns the difference between *this and y. More...
 
Ptr_Iterator operator+ (const difference_type m) const
 Returns the sum of *this and m. More...
 
Ptr_Iterator operator- (const difference_type m) const
 Returns the difference of *this and m. More...
 

Private Member Functions

const P & base () const
 Returns the hidden pointer. More...
 

Private Attributes

p
 The base pointer implementing the iterator. More...
 

Friends

template<typename Q , typename R >
bool Parma_Polyhedra_Library::Implementation::operator== (const Ptr_Iterator< Q > &x, const Ptr_Iterator< R > &y)
 
template<typename Q , typename R >
bool Parma_Polyhedra_Library::Implementation::operator!= (const Ptr_Iterator< Q > &x, const Ptr_Iterator< R > &y)
 
template<typename Q , typename R >
bool Parma_Polyhedra_Library::Implementation::operator< (const Ptr_Iterator< Q > &x, const Ptr_Iterator< R > &y)
 
template<typename Q , typename R >
bool Parma_Polyhedra_Library::Implementation::operator<= (const Ptr_Iterator< Q > &x, const Ptr_Iterator< R > &y)
 
template<typename Q , typename R >
bool Parma_Polyhedra_Library::Implementation::operator> (const Ptr_Iterator< Q > &x, const Ptr_Iterator< R > &y)
 
template<typename Q , typename R >
bool Parma_Polyhedra_Library::Implementation::operator>= (const Ptr_Iterator< Q > &x, const Ptr_Iterator< R > &y)
 
template<typename Q , typename R >
Ptr_Iterator< Q >::difference_type Parma_Polyhedra_Library::Implementation::operator- (const Ptr_Iterator< Q > &x, const Ptr_Iterator< R > &y)
 
Ptr_Iterator< P > Parma_Polyhedra_Library::Implementation::operator+ (typename Ptr_Iterator< P >::difference_type m, const Ptr_Iterator< P > &y)
 

Detailed Description

template<typename P>
class Parma_Polyhedra_Library::Implementation::Ptr_Iterator< P >

A class to define STL const and non-const iterators from pointer types.

Definition at line 68 of file Ptr_Iterator_defs.hh.

Member Typedef Documentation

template<typename P>
typedef std::iterator_traits<P>::difference_type Parma_Polyhedra_Library::Implementation::Ptr_Iterator< P >::difference_type

Definition at line 75 of file Ptr_Iterator_defs.hh.

template<typename P>
typedef std::iterator_traits<P>::pointer Parma_Polyhedra_Library::Implementation::Ptr_Iterator< P >::pointer

Definition at line 77 of file Ptr_Iterator_defs.hh.

template<typename P>
typedef std::iterator_traits<P>::reference Parma_Polyhedra_Library::Implementation::Ptr_Iterator< P >::reference

Definition at line 76 of file Ptr_Iterator_defs.hh.

Constructor & Destructor Documentation

Default constructor: no guarantees.

Definition at line 39 of file Ptr_Iterator_inlines.hh.

40  : p(P()) {
41 }
P p
The base pointer implementing the iterator.
template<typename P>
Parma_Polyhedra_Library::Implementation::Ptr_Iterator< P >::Ptr_Iterator ( const P &  q)
inlineexplicit

Construct an iterator pointing at q.

Definition at line 45 of file Ptr_Iterator_inlines.hh.

46  : p(q) {
47 }
P p
The base pointer implementing the iterator.
template<typename P >
template<typename Q >
Parma_Polyhedra_Library::Implementation::Ptr_Iterator< P >::Ptr_Iterator ( const Ptr_Iterator< Q > &  q)
inline

Copy constructor allowing the construction of a const_iterator from a non-const iterator.

Definition at line 52 of file Ptr_Iterator_inlines.hh.

53  : p(q.base()) {
54 }
P p
The base pointer implementing the iterator.

Member Function Documentation

template<typename P >
Ptr_Iterator< P >::reference Parma_Polyhedra_Library::Implementation::Ptr_Iterator< P >::operator* ( ) const
inline

Dereference operator.

Definition at line 58 of file Ptr_Iterator_inlines.hh.

58  {
59  return *p;
60 }
P p
The base pointer implementing the iterator.
template<typename P >
Ptr_Iterator< P > Parma_Polyhedra_Library::Implementation::Ptr_Iterator< P >::operator+ ( const difference_type  m) const
inline

Returns the sum of *this and m.

Definition at line 123 of file Ptr_Iterator_inlines.hh.

123  {
124  return Ptr_Iterator(p + m);
125 }
Ptr_Iterator()
Default constructor: no guarantees.
P p
The base pointer implementing the iterator.
template<typename P >
Ptr_Iterator< P > & Parma_Polyhedra_Library::Implementation::Ptr_Iterator< P >::operator++ ( )
inline

Prefix increment operator.

Definition at line 76 of file Ptr_Iterator_inlines.hh.

76  {
77  ++p;
78  return *this;
79 }
P p
The base pointer implementing the iterator.
template<typename P >
Ptr_Iterator< P > Parma_Polyhedra_Library::Implementation::Ptr_Iterator< P >::operator++ ( int  )
inline

Postfix increment operator.

Definition at line 83 of file Ptr_Iterator_inlines.hh.

83  {
84  return Ptr_Iterator(p++);
85 }
Ptr_Iterator()
Default constructor: no guarantees.
P p
The base pointer implementing the iterator.
template<typename P >
Ptr_Iterator< P > & Parma_Polyhedra_Library::Implementation::Ptr_Iterator< P >::operator+= ( const difference_type  m)
inline

Assignment-increment operator.

Definition at line 103 of file Ptr_Iterator_inlines.hh.

103  {
104  p += m;
105  return *this;
106 }
P p
The base pointer implementing the iterator.
template<typename P >
Ptr_Iterator< P >::difference_type Parma_Polyhedra_Library::Implementation::Ptr_Iterator< P >::operator- ( const Ptr_Iterator< P > &  y) const
inline

Returns the difference between *this and y.

Definition at line 117 of file Ptr_Iterator_inlines.hh.

References Parma_Polyhedra_Library::Implementation::Ptr_Iterator< P >::p.

117  {
118  return p - y.p;
119 }
P p
The base pointer implementing the iterator.
template<typename P >
Ptr_Iterator< P > Parma_Polyhedra_Library::Implementation::Ptr_Iterator< P >::operator- ( const difference_type  m) const
inline

Returns the difference of *this and m.

Definition at line 129 of file Ptr_Iterator_inlines.hh.

129  {
130  return Ptr_Iterator(p - m);
131 }
Ptr_Iterator()
Default constructor: no guarantees.
P p
The base pointer implementing the iterator.
template<typename P >
Ptr_Iterator< P > & Parma_Polyhedra_Library::Implementation::Ptr_Iterator< P >::operator-- ( )
inline

Prefix decrement operator.

Definition at line 89 of file Ptr_Iterator_inlines.hh.

89  {
90  --p;
91  return *this;
92 }
P p
The base pointer implementing the iterator.
template<typename P >
Ptr_Iterator< P > Parma_Polyhedra_Library::Implementation::Ptr_Iterator< P >::operator-- ( int  )
inline

Postfix decrement operator.

Definition at line 96 of file Ptr_Iterator_inlines.hh.

96  {
97  return Ptr_Iterator(p--);
98 }
Ptr_Iterator()
Default constructor: no guarantees.
P p
The base pointer implementing the iterator.
template<typename P >
Ptr_Iterator< P > & Parma_Polyhedra_Library::Implementation::Ptr_Iterator< P >::operator-= ( const difference_type  m)
inline

Assignment-decrement operator.

Definition at line 110 of file Ptr_Iterator_inlines.hh.

110  {
111  p -= m;
112  return *this;
113 }
P p
The base pointer implementing the iterator.
template<typename P >
Ptr_Iterator< P >::pointer Parma_Polyhedra_Library::Implementation::Ptr_Iterator< P >::operator-> ( ) const
inline

Indirect member selector.

Definition at line 64 of file Ptr_Iterator_inlines.hh.

64  {
65  return p;
66 }
P p
The base pointer implementing the iterator.
template<typename P >
Ptr_Iterator< P >::reference Parma_Polyhedra_Library::Implementation::Ptr_Iterator< P >::operator[] ( const difference_type  m) const
inline

Subscript operator.

Definition at line 70 of file Ptr_Iterator_inlines.hh.

70  {
71  return p[m];
72 }
P p
The base pointer implementing the iterator.

Friends And Related Function Documentation

template<typename P>
template<typename Q , typename R >
bool Parma_Polyhedra_Library::Implementation::operator!= ( const Ptr_Iterator< Q > &  x,
const Ptr_Iterator< R > &  y 
)
friend
template<typename P>
Ptr_Iterator<P> Parma_Polyhedra_Library::Implementation::operator+ ( typename Ptr_Iterator< P >::difference_type  m,
const Ptr_Iterator< P > &  y 
)
friend
template<typename P>
template<typename Q , typename R >
Ptr_Iterator<Q>::difference_type Parma_Polyhedra_Library::Implementation::operator- ( const Ptr_Iterator< Q > &  x,
const Ptr_Iterator< R > &  y 
)
friend
template<typename P>
template<typename Q , typename R >
bool Parma_Polyhedra_Library::Implementation::operator< ( const Ptr_Iterator< Q > &  x,
const Ptr_Iterator< R > &  y 
)
friend
template<typename P>
template<typename Q , typename R >
bool Parma_Polyhedra_Library::Implementation::operator<= ( const Ptr_Iterator< Q > &  x,
const Ptr_Iterator< R > &  y 
)
friend
template<typename P>
template<typename Q , typename R >
bool Parma_Polyhedra_Library::Implementation::operator== ( const Ptr_Iterator< Q > &  x,
const Ptr_Iterator< R > &  y 
)
friend
template<typename P>
template<typename Q , typename R >
bool Parma_Polyhedra_Library::Implementation::operator> ( const Ptr_Iterator< Q > &  x,
const Ptr_Iterator< R > &  y 
)
friend
template<typename P>
template<typename Q , typename R >
bool Parma_Polyhedra_Library::Implementation::operator>= ( const Ptr_Iterator< Q > &  x,
const Ptr_Iterator< R > &  y 
)
friend

Member Data Documentation

template<typename P>
P Parma_Polyhedra_Library::Implementation::Ptr_Iterator< P >::p
private

The base pointer implementing the iterator.

Definition at line 130 of file Ptr_Iterator_defs.hh.

Referenced by Parma_Polyhedra_Library::Implementation::Ptr_Iterator< P >::operator-().


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