[Interest] QVariantMap: constEnd() not equal to end()?

Jan Kundrát jkt at kde.org
Wed Mar 25 10:33:09 CET 2015


On Tuesday, 24 March 2015 11:28:16 CET, Jan Kundrát wrote:
> end() returns an interator, not a const_iterator. Obtaining an interator 
> (not a const_iterator) from a Qt container calls detach(), which means that 
> your QHash gets copied.

And one important correction because I wasn't very clear at first -- this 
copying only happens if the QHash was shared, i.e. if there were at least 
two instances of QHash which happened to share the underlying data.

Is your QHash shared? Be careful, this might not always be obvious and 
readily visible.

Cheers,
Jan

-- 
Trojitá, a fast Qt IMAP e-mail client -- http://trojita.flaska.net/



More information about the Interest mailing list