| 33 | begin++, cur = it->second; } } } |
| 34 | template<class I> |
| 35 | int countPrefixes(I begin, I end) { |
| 36 | node* cur = root; |
| 37 | while (true) { |
| 38 | if (begin == end) return cur->prefixes; |
| 39 | else { |
| 40 | T head = *begin; |
| 41 | typename map<T, node*>::const_iterator it; |
| 42 | it = cur->children.find(head); |
| 43 | if (it == cur->children.end()) return 0; |
| 44 | begin++, cur = it->second; } } } }; |
| 45 | // vim: cc=60 ts=2 sts=2 sw=2: |