ParIterator::operator==
Richard Kimberly Heck
rikiheck at lyx.org
Sat Nov 7 06:23:57 UTC 2020
On 11/6/20 7:37 PM, Jean-Marc Lasgouttes wrote:
> 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...
PS I'd be interested to hear if any of our C++ gurus knows a reason that
is wrong. It seems kind of obvious, and I haven't found anything about
it online, which worries me. Hey, Andre, you still reading us?
Riki
More information about the lyx-devel
mailing list