LaTeX export small speedup: Introduce RandomAccessList::position() and use it.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36931 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2010-12-18 07:37:12 +00:00
parent 280f7a7ced
commit ca91d508b2
2 changed files with 23 additions and 3 deletions

View File

@ -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);

View File

@ -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()
{