>>>>> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:
Angus> I have some questions/points for you... + // Unsafe if .find() can return .end() CoordCache::InnerParPosCache const & cache = theCoords.getParPos().find(cursor.bottom().text())->second; bv::funcs::status does the same, so it has to be safe in this setting :) // Get an iterator on the first paragraph in the cache DocIterator it(inset); it.push_back(CursorSlice(inset)); + // Do you need to check whether it.pit() == 0 after assignment? it.pit() = cache.begin()->first; pit == 0 is perfectly valid, I think. // Get an iterator after the last paragraph in the cache DocIterator et(inset); et.push_back(CursorSlice(inset)); + // What happens if cache.empty()? Is it guaranteed not to be if + // .find() above does not return .end() ? et.pit() = boost::prior(cache.end())->first; In general I believe this is safe. // Is it possible for et.pit() to be zero and // et.lastpit() to be non-zero? I don't think so. if (et.pit() >= et.lastpit()) + // Given that doc_iterator_end(inset) is identical to + // DocIterator(inset), why not be consistent? et = doc_iterator_end(inset); Indeed. All in all, I think an approach similar to this one is perfectly safe wrt bruteFind. Of course, it may be that fixing bruteFind3 is the right solution to Martin's problem. I guess what we need is some lecture from Andre' about these bruteFind functions. JMarc