2002-03-12 Lars Gullik Bjønnes <larsbj@birdstep.com>
+ * lyxtextclass.C (operator): add one item cache optimization.
+
* bufferlist.h: doxy changes
* bufferlist.C: ws changes
lyxerr << "Operator[] called with empty n" << endl;
string const name = (n.empty() ? defaultLayoutName() : n);
+
+ static string lastLayoutName;
+ static LayoutList::difference_type lastLayoutIndex;
+
+ if (name == lastLayoutName)
+ return layoutlist[lastLayoutIndex];
+
LayoutList::const_iterator cit =
find_if(layoutlist.begin(),
lyx::Assert(false);
}
+ lastLayoutName = name;
+ lastLayoutIndex = std::distance(layoutlist.begin(), cit);
+
return *cit;
}