Re: [New patch] Re: Fix for bug 2015: font properties propagation in environments

2005-11-27 Thread Andre Poenitz
On Mon, Nov 14, 2005 at 05:55:46PM +0100, Lars Gullik Bjønnes wrote: > Andre Poenitz <[EMAIL PROTECTED]> writes: > > | + pit_type pit = 0; > | + for ( ; pit < pars_.size() && &pars_[pit] != ∥ ++pit) > | + ; > > You know... terse does not mean easy to understand. That's why I usual

Re: [New patch] Re: Fix for bug 2015: font properties propagation in environments

2005-11-14 Thread Lars Gullik Bjønnes
Andre Poenitz <[EMAIL PROTECTED]> writes: | + pit_type pit = 0; | + for ( ; pit < pars_.size() && &pars_[pit] != ∥ ++pit) | + ; You know... terse does not mean easy to understand. -- Lgb

Re: [New patch] Re: Fix for bug 2015: font properties propagation in environments

2005-11-14 Thread Lars Gullik Bjønnes
Andre Poenitz <[EMAIL PROTECTED]> writes: | > ParagraphList::const_iterator it = | > find_if(pars_.begin(), pars_.end(), some_functor(par)); | | Why? It's obviously more code to type, to read, and not simpler to | understand. You obviously could write out the for loop but

Re: [New patch] Re: Fix for bug 2015: font properties propagation in environments

2005-11-11 Thread Martin Vermeer
On Sat, Nov 12, 2005 at 12:36:13AM +0100, Andre Poenitz wrote: > On Thu, Nov 10, 2005 at 03:28:42PM +0200, Martin Vermeer wrote: > > On Wed, 2005-11-09 at 14:17 +0100, Jean-Marc Lasgouttes wrote: > > > > "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes: > > > > > > Martin> So then the ori

Re: [New patch] Re: Fix for bug 2015: font properties propagation in environments

2005-11-11 Thread Andre Poenitz
On Thu, Nov 10, 2005 at 05:41:37PM +0100, Jean-Marc Lasgouttes wrote: > > "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes: > > Angus> Jean-Marc Lasgouttes wrote: > >> I have a different idea right now: since ParagraphList is a vector, > >> can't we just say that pit = &par - &pars_[0]; ? >

Re: [New patch] Re: Fix for bug 2015: font properties propagation in environments

2005-11-11 Thread Andre Poenitz
On Thu, Nov 10, 2005 at 03:28:42PM +0200, Martin Vermeer wrote: > On Wed, 2005-11-09 at 14:17 +0100, Jean-Marc Lasgouttes wrote: > > > "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes: > > > > Martin> So then the original patch should go in, with break added? How > > Martin> expensive is

Re: [New patch] Re: Fix for bug 2015: font properties propagation in environments

2005-11-11 Thread Andre Poenitz
On Fri, Nov 11, 2005 at 12:25:50AM +0100, Lars Gullik Bjønnes wrote: > | + ParagraphList::const_iterator it = pars_.begin(); > | + ParagraphList::const_iterator const end = pars_.end(); > | + while (it != end && &(*it) != &par) > | + ++it; > | + > > for (; it != end; ++i

Re: [New patch] Re: Fix for bug 2015: font properties propagation in environments

2005-11-11 Thread Lars Gullik Bjønnes
Martin Vermeer <[EMAIL PROTECTED]> writes: | On Fri, Nov 11, 2005 at 12:30:01AM +0100, Lars Gullik Bjønnes wrote: | > Martin Vermeer <[EMAIL PROTECTED]> writes: | | | > | + pit_type pit = &par - &pars_[0]; | > | > | > No... this is in the ball park of pointer arithmetic | > | > Hmm... I thi

Re: [New patch] Re: Fix for bug 2015: font properties propagation in environments

2005-11-10 Thread Martin Vermeer
On Fri, Nov 11, 2005 at 12:30:01AM +0100, Lars Gullik Bjønnes wrote: > Martin Vermeer <[EMAIL PROTECTED]> writes: > | + pit_type pit = &par - &pars_[0]; > > > No... this is in the ball park of pointer arithmetic > > Hmm... I think I basically dislike all of this... passing pointers... > pa

Re: [New patch] Re: Fix for bug 2015: font properties propagation in environments

2005-11-10 Thread Lars Gullik Bjønnes
Martin Vermeer <[EMAIL PROTECTED]> writes: | Index: text2.C | === | RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v | retrieving revision 1.634 | diff -u -p -r1.634 text2.C | --- text2.C 25 Oct 2005 09:14:11 -

Re: [New patch] Re: Fix for bug 2015: font properties propagation in environments

2005-11-10 Thread Lars Gullik Bjønnes
Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes: | > "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes: | | Martin> So... can this go in? | | Since there is a suspicion that the code is going to be slow, it would | be better to write it to be faster, like (untested): | | + Paragraph

Re: [New patch] Re: Fix for bug 2015: font properties propagation in environments

2005-11-10 Thread Lars Gullik Bjønnes
Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes: | > "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes: | | Angus> Jean-Marc Lasgouttes wrote: | >> I have a different idea right now: since ParagraphList is a vector, | >> can't we just say that pit = &par - &pars_[0]; ? | | Angus> I'm not s

Re: [New patch] Re: Fix for bug 2015: font properties propagation in environments

2005-11-10 Thread Jean-Marc Lasgouttes
> "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes: Martin> Why not both. Good idea, and still works :-) + BOOST_ASSERT(pit >=0 && pit < pars_.size() && &pars_[pit] == &par); would be even better. And also a comment that this is going to break hard with anything else than vector.

Re: [New patch] Re: Fix for bug 2015: font properties propagation in environments

2005-11-10 Thread Martin Vermeer
On Thu, 2005-11-10 at 18:08 +0100, Jean-Marc Lasgouttes wrote: > > "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes: > > Martin> Anyway this is a great idea at this point. The cost is a small > Martin> constant instead of linear with doc size. > > Martin> Tested and works. OK to go in? >

Re: [New patch] Re: Fix for bug 2015: font properties propagation in environments

2005-11-10 Thread Jean-Marc Lasgouttes
> "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes: Martin> Anyway this is a great idea at this point. The cost is a small Martin> constant instead of linear with doc size. Martin> Tested and works. OK to go in? I'd rather see the patch first. You may want to BOOST_ASSERT(&pars_[pit] =

Re: [New patch] Re: Fix for bug 2015: font properties propagation in environments

2005-11-10 Thread Martin Vermeer
On Thu, Nov 10, 2005 at 04:11:03PM +, Angus Leeming wrote: > Jean-Marc Lasgouttes wrote: > > I have a different idea right now: since ParagraphList is a vector, > > can't we just say that > > pit = &par - &pars_[0]; > > ? > > I'm not saying that would be a bad thing to do, but would note tha

Re: [New patch] Re: Fix for bug 2015: font properties propagation in environments

2005-11-10 Thread Jean-Marc Lasgouttes
> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes: Angus> Jean-Marc Lasgouttes wrote: >> I have a different idea right now: since ParagraphList is a vector, >> can't we just say that pit = &par - &pars_[0]; ? Angus> I'm not saying that would be a bad thing to do, but would note Angus> tha

Re: [New patch] Re: Fix for bug 2015: font properties propagation in environments

2005-11-10 Thread Angus Leeming
Jean-Marc Lasgouttes wrote: > I have a different idea right now: since ParagraphList is a vector, > can't we just say that > pit = &par - &pars_[0]; > ? I'm not saying that would be a bad thing to do, but would note that the fact that ParagraphList is a std::vector is meant to be an implementati

Re: [New patch] Re: Fix for bug 2015: font properties propagation in environments

2005-11-10 Thread Jean-Marc Lasgouttes
> "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes: Martin> Why would that be faster (I'm happy to comply, but why?)? do not recompute pars_size() repeatedly do not invoke operator[] repeatedly, it may be expensive. All this things are small, but there is not much more in the loop, so

Re: [New patch] Re: Fix for bug 2015: font properties propagation in environments

2005-11-10 Thread Martin Vermeer
On Thu, Nov 10, 2005 at 04:22:47PM +0100, Jean-Marc Lasgouttes wrote: > > "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes: > > Martin> So... can this go in? > > Since there is a suspicion that the code is going to be slow, it would > be better to write it to be faster, like (untested):

Re: [New patch] Re: Fix for bug 2015: font properties propagation in environments

2005-11-10 Thread Jean-Marc Lasgouttes
> "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes: Martin> So... can this go in? Since there is a suspicion that the code is going to be slow, it would be better to write it to be faster, like (untested): + ParagraphList::const_iterator it = pars_.begin(); + ParagraphList::