next up previous contents
Next: Definition Up: Cursors Previous: Description   Contents

Example

string w[4] = { "forward", "cursor", "code", "example" };
DFA_bin a;
tree_build(a, w, w + 4);
dfirst_cursor<stack_cursor<forward_cursor<DFA_bin<> > > >
  first = dfirstc(a), last;
vector<char> word;
while (first != last) {
  do {
    word.push_back(first.letter());
    if (first.aim_final()) {
      copy(word.begin(), word.end(), ostream_iterator<char>(cout));
      cout << endl;
    }
  } while (first.forward());

  while (!first.forward()) word.pop_back();
}


Vincent Le Maout 2003-07-08