Public Types | Public Member Functions | Public Attributes | List of all members
EveryOther< Container > Struct Template Reference

Public Types

typedef Container::value_type value_type
 
typedef Container::iterator iterator
 
typedef Container::const_iterator const_iterator
 

Public Member Functions

 EveryOther (const_iterator begin, const_iterator end)
 
value_type operator() ()
 
 operator bool () const
 
bool operator== (const EveryOther &rhs) const
 

Public Attributes

const_iterator it
 
const_iterator other
 
const_iterator end
 

Detailed Description

template<typename Container>
struct EveryOther< Container >

Definition at line 11 of file test_bifla.cxx.

Member Typedef Documentation

template<typename Container >
typedef Container::const_iterator EveryOther< Container >::const_iterator

Definition at line 14 of file test_bifla.cxx.

template<typename Container >
typedef Container::iterator EveryOther< Container >::iterator

Definition at line 13 of file test_bifla.cxx.

template<typename Container >
typedef Container::value_type EveryOther< Container >::value_type

Definition at line 12 of file test_bifla.cxx.

Constructor & Destructor Documentation

template<typename Container >
EveryOther< Container >::EveryOther ( const_iterator  begin,
const_iterator  end 
)
inline

Definition at line 18 of file test_bifla.cxx.

19  : it(begin), other(begin), end(end) {
20  if (other != end) ++other;
21  if (other != end) ++other;
22  cerr << "Creating EveryOther " << std::distance(begin,end) << endl;
23  }
const_iterator end
Definition: test_bifla.cxx:16
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
const_iterator it
Definition: test_bifla.cxx:16
const_iterator other
Definition: test_bifla.cxx:16
QTextStream & endl(QTextStream &s)

Member Function Documentation

template<typename Container >
EveryOther< Container >::operator bool ( ) const
inline

Definition at line 34 of file test_bifla.cxx.

34  {
35  bool exhausted = false;
36  if (end-it < 2) {
37  exhausted = true;
38  }
39  cerr << "Are we exhausted? " << exhausted << endl;
40  return !exhausted;
41  }
const_iterator end
Definition: test_bifla.cxx:16
const_iterator it
Definition: test_bifla.cxx:16
QTextStream & endl(QTextStream &s)
template<typename Container >
value_type EveryOther< Container >::operator() ( void  )
inline

Definition at line 24 of file test_bifla.cxx.

24  {
25  value_type ret{};
26  if (*this) {
27  ret = *it + *other;
28  ++it;
29  ++other;
30  }
31  cerr << "operator() returns at " << std::distance(it,end) << endl;
32  return ret;
33  }
Container::value_type value_type
Definition: test_bifla.cxx:12
const_iterator end
Definition: test_bifla.cxx:16
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
const_iterator it
Definition: test_bifla.cxx:16
const_iterator other
Definition: test_bifla.cxx:16
QTextStream & endl(QTextStream &s)
template<typename Container >
bool EveryOther< Container >::operator== ( const EveryOther< Container > &  rhs) const
inline

Definition at line 42 of file test_bifla.cxx.

42  {
43  if (this == &rhs) return true;
44  return it == rhs.it;
45  }
const_iterator it
Definition: test_bifla.cxx:16

Member Data Documentation

template<typename Container >
const_iterator EveryOther< Container >::end

Definition at line 16 of file test_bifla.cxx.

template<typename Container >
const_iterator EveryOther< Container >::it

Definition at line 16 of file test_bifla.cxx.

template<typename Container >
const_iterator EveryOther< Container >::other

Definition at line 16 of file test_bifla.cxx.


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