AFF --- A container for numbers (array) by Friederich and Forbriger.

◆ steppers()

void steppers ( const Strided shape,
const int &  nmax = 30 
)

cycle steppers

Examples:
tests/shapetest.cc.

Definition at line 97 of file shapetest.cc.

References bvalue(), aff::util::StridedStepper::current(), aff::util::StridedStepper::decr(), aff::util::StridedStepper::index(), aff::util::StridedStepper::less(), aff::Strided::Mmax_dimen, aff::util::StridedStepper::tolast(), and aff::util::StridedStepper::valid().

Referenced by main().

98 {
99  StridedStepper s1(shape), s2(shape);
100  s2.tolast();
101  for (int i=0; i<nmax; i++)
102  {
103  cout.width(3); cout << i+1;
104  cout << " ";
105  cout.width(5); cout << s1.current() << "=[";
106  for (int j=0; j<Strided::Mmax_dimen; j++)
107  {
108  if (j) cout << ", ";
109  cout.width(2); cout << s1.index(j);
110  }
111  cout << "] ";
112  cout.width(5); cout << bvalue(s1.more());
113  cout.width(6); cout << bvalue(s1.valid());
114  cout << " ";
115  cout.width(5); cout << s2.current() << "=[";
116  for (int j=0; j<Strided::Mmax_dimen; j++)
117  {
118  if (j) cout << ", ";
119  cout.width(2); cout << s2.index(j);
120  }
121  cout << "] ";
122  cout.width(5); cout << bvalue(s2.less());
123  cout.width(6); cout << bvalue(s2.valid());
124  cout << endl;
125  s1.incr();
126  s2.decr();
127  }
128 }
A stepper for all strided shapes.
const char * bvalue(const bool &b)
print value of a bool
Definition: shapetest.cc:86
Here is the call graph for this function:
Here is the caller graph for this function: