pqxx::const_result_iterator Class Reference

Iterator for rows in a result. Use as result::const_iterator. More...

#include <result.hxx>

Inheritance diagram for pqxx::const_result_iterator:
pqxx::row pqxx::const_reverse_result_iterator

List of all members.

Public Types

typedef const rowpointer
typedef row reference
typedef result::size_type size_type
typedef result::difference_type difference_type

Public Member Functions

 const_result_iterator () PQXX_NOEXCEPT
 const_result_iterator (const row &t) PQXX_NOEXCEPT
Dereferencing operators



pointer operator-> () const
reference operator* () const
Manipulations



const_result_iterator operator++ (int)
const_result_iteratoroperator++ ()
const_result_iterator operator-- (int)
const_result_iteratoroperator-- ()
const_result_iteratoroperator+= (difference_type i)
const_result_iteratoroperator-= (difference_type i)
Comparisons



bool operator== (const const_result_iterator &i) const
bool operator!= (const const_result_iterator &i) const
bool operator< (const const_result_iterator &i) const
bool operator<= (const const_result_iterator &i) const
bool operator> (const const_result_iterator &i) const
bool operator>= (const const_result_iterator &i) const

Friends

class pqxx::result

Arithmetic operators



const_result_iterator operator+ (difference_type, const_result_iterator)
const_result_iterator operator+ (difference_type) const
const_result_iterator operator- (difference_type) const
difference_type operator- (const_result_iterator) const

Detailed Description

Iterator for rows in a result. Use as result::const_iterator.

A result, once obtained, cannot be modified. Therefore there is no plain iterator type for result. However its const_iterator type can be used to inspect its rows without changing them.


Member Typedef Documentation

Reimplemented from pqxx::row.

Reimplemented from pqxx::row.

Reimplemented from pqxx::row.

Reimplemented from pqxx::row.


Constructor & Destructor Documentation

pqxx::const_result_iterator::const_result_iterator (  ) 
pqxx::const_result_iterator::const_result_iterator ( const row t  ) 

Member Function Documentation

bool pqxx::const_result_iterator::operator!= ( const const_result_iterator i  )  const

Reimplemented from pqxx::row.

Reimplemented in pqxx::const_reverse_result_iterator.

reference pqxx::const_result_iterator::operator* (  )  const
const_result_iterator pqxx::const_result_iterator::operator+ ( difference_type   )  const
const_result_iterator& pqxx::const_result_iterator::operator++ (  ) 
pqxx::const_result_iterator pqxx::const_result_iterator::operator++ ( int   ) 
const_result_iterator& pqxx::const_result_iterator::operator+= ( difference_type  i  ) 
result::difference_type pqxx::const_result_iterator::operator- ( const_result_iterator  i  )  const

References pqxx::row::num().

const_result_iterator pqxx::const_result_iterator::operator- ( difference_type   )  const
const_result_iterator& pqxx::const_result_iterator::operator-- (  ) 
pqxx::const_result_iterator pqxx::const_result_iterator::operator-- ( int   ) 
const_result_iterator& pqxx::const_result_iterator::operator-= ( difference_type  i  ) 
pointer pqxx::const_result_iterator::operator-> (  )  const

The iterator "points to" its own row, which is also itself. This allows a result to be addressed as a two-dimensional container without going through the intermediate step of dereferencing the iterator. I hope this works out to be similar to C pointer/array semantics in useful cases.

IIRC Alex Stepanov, the inventor of the STL, once remarked that having this as standard behaviour for pointers would be useful in some algorithms. So even if this makes me look foolish, I would seem to be in distinguished company.

bool pqxx::const_result_iterator::operator< ( const const_result_iterator i  )  const
bool pqxx::const_result_iterator::operator<= ( const const_result_iterator i  )  const
bool pqxx::const_result_iterator::operator== ( const const_result_iterator i  )  const

Reimplemented from pqxx::row.

Reimplemented in pqxx::const_reverse_result_iterator.

bool pqxx::const_result_iterator::operator> ( const const_result_iterator i  )  const
bool pqxx::const_result_iterator::operator>= ( const const_result_iterator i  )  const

Friends And Related Function Documentation

friend class pqxx::result [friend]

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

Generated on 16 Mar 2017 for libpqxx by  doxygen 1.6.1