diff --git a/src/output_latex.cpp b/src/output_latex.cpp index 4f39ee58d7..cc56d6b672 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -413,7 +413,7 @@ void TeXOnePar(Buffer const & buf, } if (text.inset().getLayout().isPassThru()) { - int const dist = distance(paragraphs.begin(), pit); + int const dist = paragraphs.position(pit); Font const outerfont = text.outerFont(dist); // No newline before first paragraph in this lyxtext @@ -432,7 +432,7 @@ void TeXOnePar(Buffer const & buf, } if (style.pass_thru) { - int const dist = distance(paragraphs.begin(), pit); + int const dist = paragraphs.position(pit); Font const outerfont = text.outerFont(dist); pit->latex(bparams, outerfont, os, texrow, runparams, start_pos, end_pos); @@ -690,7 +690,7 @@ void TeXOnePar(Buffer const & buf, break; } - Font const outerfont = text.outerFont(distance(paragraphs.begin(), pit)); + Font const outerfont = text.outerFont(paragraphs.position(pit)); // FIXME UNICODE os << from_utf8(everypar); diff --git a/src/support/RandomAccessList.h b/src/support/RandomAccessList.h index 7b0f1032dd..4c48b36db2 100644 --- a/src/support/RandomAccessList.h +++ b/src/support/RandomAccessList.h @@ -273,6 +273,26 @@ public: iterCont_.clear(); } + size_t position(iterator it) const + { + size_t const s = iterCont_.size(); + for (size_t i = 0; it != s; ++i) { + if (iterCont_[i] == it) + return i; + } + return s; + } + + size_t position(const_iterator it) const + { + size_t const s = iterCont_.size(); + for (size_t i = 0; i != s; ++i) { + if (iterCont_[i] == it) + return i; + } + return s; + } + private: void recreateVector() {