I have never liked OUT arguements... and when I see code like:

  ParagraphList::iterator beg, end;
  getSelectionSpan(cur, *this, beg, end);

I get a chilly feeling (in the shoulder region).

I would have prefered:

  ParagraphList::iterator beg, end;
  boost::tie(beg, end) = getSelectionSpan(cur, *this);

And have the getSelectionSpan return a pair or a tuple.


getSelectionSpan would then look like this:

std::pair<ParagraphList::iterator, ParagraphList::iterator>
getSelectionSpan(LCursor & cur, LyXText & text)
{
        ParagraphList::iterator beg, end;

        if (!cur.selection()) {
           beg = text.getPar(cur.par());
           end = boost::next(beg);
        } else {
           beg = text.getPar(cur.selBegin());
           end = boost::next(text.getPar(cur.selEnd()));
        }

        return make_pair(beg, end);
}

(also why coudn't cur and text be const refs in this funtion?)

-- 
        Lgb

Reply via email to