I know that I am the one who began introducing pimpls to lyx. After that I have become quite wary of them... and feel more and more that you should have a good reason to use them.
This boils down to: (right now) What is the use of the pimpl in ParIterator? I have a patch where I remove it, get rid of asPosIterator, etc. I think it is nice and it makes the code size smaller (should be faster as well.) This is with gcc 3.4 prerelease and cvs boost.
? 1 Index: BranchList.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BranchList.C,v retrieving revision 1.10 diff -u -p -b -r1.10 BranchList.C Index: PosIterator.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/PosIterator.C,v retrieving revision 1.5 diff -u -p -b -r1.5 PosIterator.C --- PosIterator.C 3 Dec 2003 18:17:15 -0000 1.5 +++ PosIterator.C 3 Jan 2004 14:18:14 -0000 @@ -26,6 +26,58 @@ using boost::prior; + +PosIterator::PosIterator(ParagraphList * pl, + ParagraphList::iterator pit, + lyx::pos_type pos) +{ + stack_.push_back(PosIteratorItem(pl, pit, pos)); +} + + +PosIterator::PosIterator(BufferView & bv) +{ + LyXText * text = bv.getLyXText(); + lyx::pos_type pos = text->cursor.pos(); + ParagraphList::iterator pit = text->cursorPar(); + + ParIterator par = bv.buffer()->par_iterator_begin(); + ParIterator end = bv.buffer()->par_iterator_end(); + for ( ; par != end; ++par) { + if (par.pit() == pit) + break; + } + + setFrom(par, pos); +} + + +PosIterator::PosIterator(ParIterator const & par, lyx::pos_type pos) +{ + setFrom(par, pos); +} + + +void PosIterator::setFrom(ParIterator const & par, lyx::pos_type pos) +{ + BOOST_ASSERT(par.size() > 0); + + ParIterator::PosHolder const & ph = par.positions(); + + int const last = par.size() - 1; + for (int i = 0; i < last; ++i) { + ParPosition const & pp = ph[i]; + stack_.push_back( + PosIteratorItem(const_cast<ParagraphList *>(pp.plist), + pp.pit, (*pp.it)->pos, *pp.index + 1)); + } + ParPosition const & pp = ph[last]; + stack_.push_back( + PosIteratorItem(const_cast<ParagraphList *>(pp.plist), pp.pit, pos, 0)); +} + + + PosIterator & PosIterator::operator++() { BOOST_ASSERT(!stack_.empty()); @@ -95,15 +147,8 @@ PosIterator & PosIterator::operator--() } -bool operator!=(PosIterator const & lhs, PosIterator const & rhs) -{ - return !(lhs == rhs); -} - - bool operator==(PosIterator const & lhs, PosIterator const & rhs) { - PosIteratorItem const & li = lhs.stack_.back(); PosIteratorItem const & ri = rhs.stack_.back(); @@ -118,53 +163,10 @@ bool PosIterator::at_end() const } -PosIterator::PosIterator(ParagraphList * pl, ParagraphList::iterator pit, - lyx::pos_type pos) -{ - stack_.push_back(PosIteratorItem(pl, pit, pos)); -} - - -PosIterator::PosIterator(BufferView & bv) -{ - LyXText * text = bv.getLyXText(); - lyx::pos_type pos = text->cursor.pos(); - ParagraphList::iterator pit = text->cursorPar(); - - ParIterator par = bv.buffer()->par_iterator_begin(); - ParIterator end = bv.buffer()->par_iterator_end(); - for ( ; par != end; ++par) { - if (par.pit() == pit) - break; - } - - operator=(par.asPosIterator(pos)); -} - - InsetOld * PosIterator::inset() const { if (stack_.size() == 1) return 0; PosIteratorItem const & pi = stack_[stack_.size() - 2]; return pi.pit->getInset(pi.pos); -} - - -int distance(PosIterator const & cur, PosIterator const & end) -{ - PosIterator p = cur; - int count = 0; - for (; p != end; ++p, ++count) - ; - return count; -} - - -void advance(PosIterator & cur, int howmuch) -{ - for (int i = 0; i < howmuch; ++i) - ++cur; - for (int i = 0; i > howmuch; --i) - --cur; } Index: PosIterator.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/PosIterator.h,v retrieving revision 1.5 diff -u -p -b -r1.5 PosIterator.h --- PosIterator.h 7 Nov 2003 09:40:48 -0000 1.5 +++ PosIterator.h 3 Jan 2004 14:18:14 -0000 @@ -36,14 +36,18 @@ struct PosIteratorItem }; -class PosIterator +class PosIterator : public std::iterator< + std::bidirectional_iterator_tag, + ParagraphList::value_type> { public: + // Creates a singular. + PosIterator() {}; + PosIterator(BufferView & bv); - PosIterator(ParIterator & par, lyx::pos_type pos); PosIterator(ParagraphList * pl, ParagraphList::iterator pit, lyx::pos_type pos); - PosIterator(ParIterator const & parit, lyx::pos_type p); + PosIterator(ParIterator const & par, lyx::pos_type pos); PosIterator & operator++(); PosIterator & operator--(); friend bool operator==(PosIterator const &, PosIterator const &); @@ -52,20 +56,24 @@ public: lyx::pos_type pos() const { return stack_.back().pos; } bool at_end() const; InsetOld * inset() const; - friend PosIterator ParIterator::asPosIterator(lyx::pos_type) const; +// friend PosIterator ParIterator::asPosIterator(lyx::pos_type) const; friend ParIterator::ParIterator(PosIterator const &); private: - PosIterator() {}; - //this is conceptually a stack, but we need random access sometimes + void setFrom(ParIterator const & par, lyx::pos_type pos); + // This is conceptually a stack, + // but we need random access sometimes. std::vector<PosIteratorItem> stack_; }; -bool operator!=(PosIterator const &, PosIterator const &); + bool operator==(PosIterator const &, PosIterator const &); -int distance(PosIterator const &, PosIterator const &); -void advance(PosIterator &, int); -#endif +inline +bool operator!=(PosIterator const & lhs, PosIterator const & rhs) +{ + return !(lhs == rhs); +} +#endif Index: iterators.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/iterators.C,v retrieving revision 1.36 diff -u -p -b -r1.36 iterators.C --- iterators.C 5 Dec 2003 08:33:38 -0000 1.36 +++ iterators.C 3 Jan 2004 14:18:14 -0000 @@ -24,30 +24,13 @@ #include "insets/insettext.h" #include <boost/next_prior.hpp> -#include <boost/optional.hpp> using boost::next; -using boost::optional; -using std::vector; /// /// ParPosition /// -class ParPosition { -public: - /// - ParPosition(ParagraphList::iterator p, ParagraphList const & pl); - /// - ParagraphList::iterator pit; - /// - ParagraphList const * plist; - /// - optional<InsetList::iterator> it; - /// - optional<int> index; -}; - ParPosition::ParPosition(ParagraphList::iterator p, ParagraphList const & pl) : pit(p), plist(&pl) @@ -74,15 +57,9 @@ bool operator!=(ParPosition const & pos1 /// ParIterator /// -struct ParIterator::Pimpl { - typedef vector<ParPosition> PosHolder; - PosHolder positions; -}; - ParIterator::ParIterator(ParagraphList::iterator pit, ParagraphList const & pl) - : pimpl_(new Pimpl) { - pimpl_->positions.push_back(ParPosition(pit, pl)); + positions_.push_back(ParPosition(pit, pl)); } @@ -91,21 +68,21 @@ ParIterator::~ParIterator() ParIterator::ParIterator(ParIterator const & pi) - : pimpl_(new Pimpl(*pi.pimpl_)) + : positions_(pi.positions_) {} void ParIterator::operator=(ParIterator const & pi) { ParIterator tmp(pi); - pimpl_.swap(tmp.pimpl_); + swap(positions_ , tmp.positions_); } ParIterator & ParIterator::operator++() { - while (!pimpl_->positions.empty()) { - ParPosition & p = pimpl_->positions.back(); + while (!positions_.empty()) { + ParPosition & p = positions_.back(); // Does the current inset contain more "cells" ? if (p.index) { @@ -113,7 +90,7 @@ ParIterator & ParIterator::operator++() if (LyXText * text = (*p.it)->inset->getText(*p.index)) { ParagraphList & plist = text->paragraphs(); if (!plist.empty()) { - pimpl_->positions.push_back(ParPosition(plist.begin(), plist)); + positions_.push_back(ParPosition(plist.begin(), plist)); return *this; } } @@ -132,7 +109,7 @@ ParIterator & ParIterator::operator++() ParagraphList & plist = text->paragraphs(); if (!plist.empty()) { p.index.reset(0); - pimpl_->positions.push_back(ParPosition(plist.begin(), plist)); + positions_.push_back(ParPosition(plist.begin(), plist)); return *this; } } @@ -140,7 +117,7 @@ ParIterator & ParIterator::operator++() // Try to go to the next paragarph if (next(p.pit) != const_cast<ParagraphList*>(p.plist)->end() - || pimpl_->positions.size() == 1) { + || positions_.size() == 1) { ++p.pit; p.index.reset(); p.it.reset(); @@ -149,7 +126,7 @@ ParIterator & ParIterator::operator++() } // Drop end and move up in the stack. - pimpl_->positions.pop_back(); + positions_.pop_back(); } return *this; } @@ -158,10 +135,10 @@ ParIterator & ParIterator::operator++() LyXText * ParIterator::text(Buffer & buf) const { //lyxerr << "positions.size: " << pimpl_->positions.size() << std::endl; - if (pimpl_->positions.size() <= 1) + if (positions_.size() <= 1) return &buf.text(); - ParPosition const & pos = pimpl_->positions[pimpl_->positions.size() - 2]; + ParPosition const & pos = positions_[positions_.size() - 2]; return (*pos.it)->inset->getText(*pos.index); } @@ -169,62 +146,94 @@ LyXText * ParIterator::text(Buffer & buf InsetOld * ParIterator::inset() const { //lyxerr << "positions.size: " << pimpl_->positions.size() << std::endl; - if (pimpl_->positions.size() <= 1) + if (positions_.size() <= 1) return 0; - ParPosition const & pos = pimpl_->positions[pimpl_->positions.size() - 2]; + ParPosition const & pos = positions_[positions_.size() - 2]; return (*pos.it)->inset; } int ParIterator::index() const { - if (pimpl_->positions.size() <= 1) + if (positions_.size() <= 1) return 0; - return *(pimpl_->positions[pimpl_->positions.size() - 2].index); + return *(positions_[positions_.size() - 2].index); } Paragraph & ParIterator::operator*() const { - return *pimpl_->positions.back().pit; + return *positions_.back().pit; } ParagraphList::iterator ParIterator::pit() const { - return pimpl_->positions.back().pit; + return positions_.back().pit; } ParagraphList::iterator ParIterator::operator->() const { - return pimpl_->positions.back().pit; + return positions_.back().pit; } ParagraphList::iterator ParIterator::outerPar() const { - return pimpl_->positions[0].pit; + return positions_[0].pit; } size_t ParIterator::size() const { - return pimpl_->positions.size(); + return positions_.size(); } ParagraphList & ParIterator::plist() const { - return *const_cast<ParagraphList*>(pimpl_->positions.back().plist); + return *const_cast<ParagraphList*>(positions_.back().plist); +} + + +ParIterator::ParIterator(PosIterator const & pos) +{ + int const size = pos.stack_.size(); + + for (int i = 0; i < size; ++i) { + PosIteratorItem const & it = pos.stack_[i]; + ParPosition pp(it.pit, *it.pl); + if (i < size - 1) { + InsetOld * inset = it.pit->getInset(it.pos); + BOOST_ASSERT(inset); + InsetList::iterator beg = it.pit->insetlist.begin(); + InsetList::iterator end = it.pit->insetlist.end(); + for ( ; beg != end && beg->inset != inset; ++beg) + ; + pp.it.reset(beg); + pp.index.reset(it.index - 1); + } + positions_.push_back(pp); + } +} + + +void ParIterator::lockPath(BufferView * bv) const +{ + bv->cursor() = LCursor(bv); + int last = size() - 1; +#warning this seems to create just one entry for InsetTabulars + for (int i = 0; i < last; ++i) + (*positions_[i].it)->inset->edit(bv, true); } bool operator==(ParIterator const & iter1, ParIterator const & iter2) { - return iter1.pimpl_->positions == iter2.pimpl_->positions; + return iter1.positions() == iter2.positions(); } @@ -239,17 +248,10 @@ bool operator!=(ParIterator const & iter /// -struct ParConstIterator::Pimpl { - typedef vector<ParPosition> PosHolder; - PosHolder positions; -}; - - ParConstIterator::ParConstIterator(ParagraphList::iterator pit, ParagraphList const & pl) - : pimpl_(new Pimpl) { - pimpl_->positions.push_back(ParPosition(pit, pl)); + positions_.push_back(ParPosition(pit, pl)); } @@ -258,14 +260,14 @@ ParConstIterator::~ParConstIterator() ParConstIterator::ParConstIterator(ParConstIterator const & pi) - : pimpl_(new Pimpl(*pi.pimpl_)) + : positions_(pi.positions_) {} ParConstIterator & ParConstIterator::operator++() { - while (!pimpl_->positions.empty()) { - ParPosition & p = pimpl_->positions.back(); + while (!positions_.empty()) { + ParPosition & p = positions_.back(); // Does the current inset contain more "cells" ? if (p.index) { @@ -273,7 +275,7 @@ ParConstIterator & ParConstIterator::ope if (LyXText * text = (*p.it)->inset->getText(*p.index)) { ParagraphList & plist = text->paragraphs(); if (!plist.empty()) { - pimpl_->positions.push_back(ParPosition(plist.begin(), plist)); + positions_.push_back(ParPosition(plist.begin(), plist)); return *this; } } @@ -292,7 +294,7 @@ ParConstIterator & ParConstIterator::ope ParagraphList & plist = text->paragraphs(); if (!plist.empty()) { p.index.reset(0); - pimpl_->positions.push_back(ParPosition(plist.begin(), plist)); + positions_.push_back(ParPosition(plist.begin(), plist)); return *this; } } @@ -300,7 +302,7 @@ ParConstIterator & ParConstIterator::ope // Try to go to the next paragarph if (next(p.pit) != const_cast<ParagraphList*>(p.plist)->end() - || pimpl_->positions.size() == 1) { + || positions_.size() == 1) { ++p.pit; p.index.reset(); p.it.reset(); @@ -309,7 +311,7 @@ ParConstIterator & ParConstIterator::ope } // Drop end and move up in the stack. - pimpl_->positions.pop_back(); + positions_.pop_back(); } return *this; @@ -318,92 +320,41 @@ ParConstIterator & ParConstIterator::ope Paragraph const & ParConstIterator::operator*() const { - return *pimpl_->positions.back().pit; + return *positions_.back().pit; } ParagraphList::const_iterator ParConstIterator::pit() const { - return pimpl_->positions.back().pit; + return positions_.back().pit; } ParagraphList::const_iterator ParConstIterator::operator->() const { - return pimpl_->positions.back().pit; + return positions_.back().pit; } ParagraphList const & ParConstIterator::plist() const { - return *pimpl_->positions.back().plist; + return *positions_.back().plist; } size_t ParConstIterator::size() const { - return pimpl_->positions.size(); + return positions_.size(); } bool operator==(ParConstIterator const & iter1, ParConstIterator const & iter2) { - return iter1.pimpl_->positions == iter2.pimpl_->positions; + return iter1.positions() == iter2.positions(); } bool operator!=(ParConstIterator const & iter1, ParConstIterator const & iter2) { return !(iter1 == iter2); -} - - -PosIterator ParIterator::asPosIterator(lyx::pos_type pos) const -{ - PosIterator p; - - int const last = size() - 1; - for (int i = 0; i < last; ++i) { - ParPosition & pp = pimpl_->positions[i]; - p.stack_.push_back( - PosIteratorItem(const_cast<ParagraphList *>(pp.plist), - pp.pit, (*pp.it)->pos, *pp.index + 1)); - } - ParPosition const & pp = pimpl_->positions[last]; - p.stack_.push_back( - PosIteratorItem(const_cast<ParagraphList *>(pp.plist), pp.pit, pos, 0)); - return p; -} - - -ParIterator::ParIterator(PosIterator const & pos) - : pimpl_(new Pimpl) -{ - int const size = pos.stack_.size(); - - for (int i = 0; i < size; ++i) { - PosIteratorItem const & it = pos.stack_[i]; - ParPosition pp(it.pit, *it.pl); - if (i < size - 1) { - InsetOld * inset = it.pit->getInset(it.pos); - BOOST_ASSERT(inset); - InsetList::iterator beg = it.pit->insetlist.begin(); - InsetList::iterator end = it.pit->insetlist.end(); - for ( ; beg != end && beg->inset != inset; ++beg) - ; - pp.it.reset(beg); - pp.index.reset(it.index - 1); - } - pimpl_->positions.push_back(pp); - } -} - - -void ParIterator::lockPath(BufferView * bv) const -{ - bv->cursor() = LCursor(bv); - int last = size() - 1; -#warning this seems to create just one entry for InsetTabulars - for (int i = 0; i < last; ++i) - (*pimpl_->positions[i].it)->inset->edit(bv, true); } Index: iterators.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/iterators.h,v retrieving revision 1.25 diff -u -p -b -r1.25 iterators.h --- iterators.h 1 Dec 2003 13:35:38 -0000 1.25 +++ iterators.h 3 Jan 2004 14:18:14 -0000 @@ -13,9 +13,13 @@ #define ITERATORS_H #include "ParagraphList_fwd.h" +#include "InsetList.h" + #include "support/types.h" -#include <boost/scoped_ptr.hpp> +#include <boost/optional.hpp> + +#include <vector> class LyXText; class InsetOld; @@ -25,7 +29,25 @@ class BufferView; class PosIterator; -class ParIterator { +class ParPosition { +public: + /// + ParPosition(ParagraphList::iterator p, ParagraphList const & pl); + /// + ParagraphList::iterator pit; + /// + ParagraphList const * plist; + /// + boost::optional<InsetList::iterator> it; + /// + boost::optional<int> index; +}; + + +class ParIterator : public std::iterator< + std::forward_iterator_tag, + ParagraphList::value_type> +{ public: /// ParIterator(ParagraphList::iterator pit, ParagraphList const & pl); @@ -58,16 +80,15 @@ public: /// size_t size() const; /// - friend - bool operator==(ParIterator const & iter1, ParIterator const & iter2); - /// void lockPath(BufferView *) const; - /// - PosIterator asPosIterator(lyx::pos_type) const; + typedef std::vector<ParPosition> PosHolder; + PosHolder const & positions() const + { + return positions_; + } private: - struct Pimpl; - boost::scoped_ptr<Pimpl> pimpl_; + PosHolder positions_; }; /// @@ -77,7 +98,10 @@ bool operator==(ParIterator const & iter bool operator!=(ParIterator const & iter1, ParIterator const & iter2); -class ParConstIterator { +class ParConstIterator : public std::iterator< + std::forward_iterator_tag, + ParagraphList::value_type> +{ public: /// ParConstIterator(ParagraphList::iterator pit, ParagraphList const & pl); @@ -98,14 +122,13 @@ public: /// depth of nesting size_t size() const; - /// - friend - bool operator==(ParConstIterator const & iter1, - ParConstIterator const & iter2); - + typedef std::vector<ParPosition> PosHolder; + PosHolder const & positions() const + { + return positions_; + } private: - struct Pimpl; - boost::scoped_ptr<Pimpl> pimpl_; + PosHolder positions_; }; bool operator==(ParConstIterator const & iter1, Index: lyxfind.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfind.C,v retrieving revision 1.61 diff -u -p -b -r1.61 lyxfind.C --- lyxfind.C 12 Dec 2003 15:19:32 -0000 1.61 +++ lyxfind.C 3 Jan 2004 14:18:14 -0000 @@ -106,7 +106,7 @@ bool findBackwards(PosIterator & cur, Po bool findChange(PosIterator & cur, PosIterator const & end) { for (; cur != end; ++cur) { - if ((!cur.pit()->size() || !cur.at_end()) + if ((cur.pit()->empty() || !cur.at_end()) && cur.pit()->lookupChange(cur.pos()) != Change::UNCHANGED) return true; } @@ -175,7 +175,7 @@ int replaceAll(BufferView * bv, = cur.pit()->getFontSettings(buf.params(), pos); int striked = ssize - cur.pit()->erase(pos, pos + ssize); cur.pit()->insert(pos, replacestr, font); - advance(cur, rsize + striked); + std::advance(cur, rsize + striked); ++num; } Index: lyxtextclass.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxtextclass.C,v retrieving revision 1.45 diff -u -p -b -r1.45 lyxtextclass.C --- lyxtextclass.C 1 Dec 2003 16:01:49 -0000 1.45 +++ lyxtextclass.C 3 Jan 2004 14:18:14 -0000 @@ -827,14 +827,12 @@ bool LyXTextClass::delete_layout(string if (name == defaultLayoutName()) return false; - LayoutList::iterator it = - remove_if(layoutlist_.begin(), layoutlist_.end(), - compare_name(name)); - LayoutList::iterator end = layoutlist_.end(); - bool const ret = (it != end); - layoutlist_.erase(it, end); - return ret; + LayoutList::iterator it = layoutlist_.erase( + remove_if(layoutlist_.begin(), end, + compare_name(name)), end); + + return it != end; } Index: text.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v retrieving revision 1.512 diff -u -p -b -r1.512 text.C --- text.C 18 Dec 2003 04:43:06 -0000 1.512 +++ text.C 3 Jan 2004 14:18:15 -0000 @@ -1400,8 +1400,7 @@ ParagraphList::iterator LyXText::getPar( BOOST_ASSERT(par >= 0); BOOST_ASSERT(par < int(paragraphs().size())); ParagraphList::iterator pit = paragraphs().begin(); - std::advance(pit, par); - return pit; + return boost::next(pit, par); } @@ -1932,4 +1931,3 @@ int LyXText::cursorY(LyXCursor const & c Row & row = *par.getRow(cur.pos()); return par.y + row.y_offset() + row.baseline(); } - Index: undo.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/undo.C,v retrieving revision 1.31 diff -u -p -b -r1.31 undo.C Index: vspace.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/vspace.C,v retrieving revision 1.80 diff -u -p -b -r1.80 vspace.C Index: frontends/controllers/ControlErrorList.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlErrorList.C,v retrieving revision 1.16 diff -u -p -b -r1.16 ControlErrorList.C --- frontends/controllers/ControlErrorList.C 6 Nov 2003 10:52:15 -0000 1.16 +++ frontends/controllers/ControlErrorList.C 3 Jan 2004 14:18:15 -0000 @@ -74,6 +74,6 @@ void ControlErrorList::goTo(int item) int const range = end - start; // Now make the selection. - PosIterator const pos = pit.asPosIterator(start); + PosIterator const pos(pit, start); bv_funcs::put_selection_at(kernel().bufferview(), pos, range, false); } Index: frontends/controllers/ControlExternal.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlExternal.C,v retrieving revision 1.53 diff -u -p -b -r1.53 ControlExternal.C --- frontends/controllers/ControlExternal.C 4 Dec 2003 18:51:55 -0000 1.53 +++ frontends/controllers/ControlExternal.C 3 Jan 2004 14:18:15 -0000 @@ -127,9 +127,7 @@ int ControlExternal::getTemplateNumber(s external::Template ControlExternal::getTemplate(int i) const { external::TemplateManager::Templates::const_iterator i1 - = external::TemplateManager::get().getTemplates().begin(); - - std::advance(i1, i); + = boost::next(external::TemplateManager::get().getTemplates().begin(), i); return i1->second; } Index: frontends/controllers/ControlSendto.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlSendto.C,v retrieving revision 1.22 diff -u -p -b -r1.22 ControlSendto.C --- frontends/controllers/ControlSendto.C 6 Oct 2003 15:42:46 -0000 1.22 +++ frontends/controllers/ControlSendto.C 3 Jan 2004 14:18:15 -0000 @@ -85,13 +85,7 @@ vector<Format const *> const ControlSend // Remove repeated formats. std::sort(to.begin(), to.end()); - - vector<Format const *>::iterator to_begin = to.begin(); - vector<Format const *>::iterator to_end = to.end(); - vector<Format const *>::iterator to_it = - std::unique(to_begin, to_end); - if (to_it != to_end) - to.erase(to_it, to_end); + to.erase(std::unique(to.begin(), to.end()), to.end()); return to; } Index: frontends/controllers/ControlSpellchecker.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlSpellchecker.C,v retrieving revision 1.59 diff -u -p -b -r1.59 ControlSpellchecker.C --- frontends/controllers/ControlSpellchecker.C 7 Nov 2003 09:40:48 -0000 1.59 +++ frontends/controllers/ControlSpellchecker.C 3 Jan 2004 14:18:16 -0000 @@ -195,8 +195,9 @@ void ControlSpellchecker::check() PosIterator const beg = buffer()->pos_iterator_begin(); PosIterator const end = buffer()->pos_iterator_end(); - int start = distance(beg, cur); - int const total = start + distance(cur, end); + PosIterator::difference_type start = std::distance(beg, cur); + PosIterator::difference_type const total = + start + std::distance(cur, end); if (cur != buffer()->pos_iterator_begin()) for (; cur != end && isLetter(cur); ++cur, ++start); @@ -235,9 +236,9 @@ void ControlSpellchecker::check() if (!word_.word().empty()) { int const size = word_.word().size(); - advance(cur, -size); + std::advance(cur, -size); bv_funcs::put_selection_at(bufferview(), cur, size, false); - advance(cur, size); + std::advance(cur, size); } else { showSummary(); endSession(); Index: insets/Makefile.am =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/Makefile.am,v retrieving revision 1.75 diff -u -p -b -r1.75 Makefile.am --- insets/Makefile.am 14 Dec 2003 13:47:40 -0000 1.75 +++ insets/Makefile.am 3 Jan 2004 14:18:16 -0000 @@ -117,4 +117,4 @@ libinsets_la_SOURCES = \ # insetsection.h \ # insetsection.C \ # insettheorem.C \ -# insettheorem.h \ +# insettheorem.h Index: support/BoostFormat.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/BoostFormat.h,v retrieving revision 1.5 diff -u -p -b -r1.5 BoostFormat.h --- support/BoostFormat.h 23 Aug 2003 00:16:56 -0000 1.5 +++ support/BoostFormat.h 3 Jan 2004 14:18:16 -0000 @@ -39,11 +39,11 @@ str<char, std::char_traits<char> >(boost namespace detail { -extern template -bool parse_printf_directive<char, std::char_traits<char> > -(std::string const &, std::string::size_type*, - format_item<char, std::char_traits<char> >*, - std::ios &, unsigned char); +// extern template +// bool parse_printf_directive<char, std::char_traits<char> > +// (std::string const &, std::string::size_type*, +// format_item<char, std::char_traits<char> >*, +// std::ios &, unsigned char); extern template void distribute<char, std::char_traits<char>, std::string const &> Index: support/boost-inst.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/boost-inst.C,v retrieving revision 1.6 diff -u -p -b -r1.6 boost-inst.C --- support/boost-inst.C 8 Sep 2003 00:33:40 -0000 1.6 +++ support/boost-inst.C 3 Jan 2004 14:18:16 -0000 @@ -34,11 +34,11 @@ str<char, std::char_traits<char> >(boost namespace detail { -template -bool parse_printf_directive<char, std::char_traits<char> > -(std::string const &, std::string::size_type*, - format_item<char, std::char_traits<char> >*, - std::ios &, unsigned char); +// template +// bool parse_printf_directive<char, std::char_traits<char> > +// (std::string const &, std::string::size_type*, +// format_item<char, std::char_traits<char> >*, +// std::ios &, unsigned char); template void distribute<char, std::char_traits<char>, std::string const &>
-- Lgb