+2003-05-28 Lars Gullik Bjønnes <larsbj@lyx.org>
+
+ * lyxtextclass.C (operator): remove caching.
+
2003-05-27 Lars Gullik Bjønnes <larsbj@gullik.net>
* text3.C: adjust
-LyXLayout_ptr const & LyXTextClass::operator[](string const & n) const
+LyXLayout_ptr const & LyXTextClass::operator[](string const & name) const
{
- lyx::Assert(!n.empty());
-
- if (n.empty())
- lyxerr << "LyXTextClass::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];
+ lyx::Assert(!name.empty());
LayoutList::const_iterator cit =
find_if(layoutlist_.begin(),
lyx::Assert(false);
}
- lastLayoutName = name;
- lastLayoutIndex = std::distance(layoutlist_.begin(), cit);
-
return (*cit);
}