ParIterator::operator==

Jean-Marc Lasgouttes lasgouttes at lyx.org
Sat Nov 7 00:37:11 UTC 2020


Le 06/11/2020 à 17:29, Richard Kimberly Heck a écrit :
> This method is commented out ostensibly because the current implementation
> 
> bool operator==(ParConstIterator const & iter1, ParConstIterator const & 
> iter2)
> {
>      // FIXME: this makes two full copies!
>      return DocIterator(iter1) == DocIterator(iter2);
> }
> 
> made two copies, so was expensive. But what about:
> 
> bool operator==(ParConstIterator const & iter1, ParConstIterator const & 
> iter2)
> {
>      DocIterator const * dit1 = &iter1;
>      DocIterator const * dit2 = &iter2;
>      return *dit1 == *dit2;
> }
> 
> ? That should work, yes? It does compile...
> 
> Is this a method we would like to have? If not, I'd propose just to 
> remove the dead code.

If we do not use it, I would keep it commented out for now, even in its 
new version.

JMarc


More information about the lyx-devel mailing list