My Project
fac_iterfor.h
Go to the documentation of this file.
1 /* emacs edit mode for this file is -*- C++ -*- */
2 
3 #ifndef INCL_FAC_ITERFOR_H
4 #define INCL_FAC_ITERFOR_H
5 
6 // #include "config.h"
7 
8 #ifndef NOSTREAMIO
9 #ifdef HAVE_IOSTREAM
10 #include <iostream>
11 #define OSTREAM std::ostream
12 #elif defined(HAVE_IOSTREAM_H)
13 #include <iostream.h>
14 #define OSTREAM ostream
15 #endif
16 #endif /* NOSTREAMIO */
17 
19 {
20 private:
21  int MAX;
22  int FROM;
23  int TO;
24  int N;
25  bool last;
26  int * index;
27  int * imax;
28  void fill ( int from, int n );
29 public:
30  IteratedFor( int from, int to, int max );
34  int from() const { return FROM; }
35  int to() const { return TO; }
36  int n() const { return N; };
37  int max() const { return MAX; }
38  void nextiteration();
39  void operator++ () { nextiteration(); }
40  void operator++ ( int ) { nextiteration(); }
41  bool iterations_left() const { return ! last; }
42  int operator[] ( int ) const;
43 };
44 
45 #ifndef NOSTREAMIO
47 #endif /* NOSTREAMIO */
48 
49 #endif /* ! INCL_FAC_ITERFOR_H */
int operator[](int) const
int * imax
Definition: fac_iterfor.h:27
IteratedFor(int from, int to, int max)
void nextiteration()
int max() const
Definition: fac_iterfor.h:37
int from() const
Definition: fac_iterfor.h:34
bool iterations_left() const
Definition: fac_iterfor.h:41
int to() const
Definition: fac_iterfor.h:35
void operator++()
Definition: fac_iterfor.h:39
void fill(int from, int n)
IteratedFor(const IteratedFor &)
int n() const
Definition: fac_iterfor.h:36
IteratedFor & operator=(const IteratedFor &)
int * index
Definition: fac_iterfor.h:26
#define OSTREAM
Definition: fac_iterfor.h:11
OSTREAM & operator<<(OSTREAM &, const IteratedFor &)