[Development] Qt 5 types under consideration for deprecation / removal in Qt 6
mardy at users.sourceforge.net
Thu May 30 12:38:08 CEST 2019
On 30/05/19 11:40, Mutz, Marc wrote:
> On 2019-05-30 10:23, Alberto Mardegan wrote:
>> It's not clear to me why splice() cannot be implemented: it would just
>> mean that the list data would detach as in all other non-const methods.
>> Or am I missing something?
> You're passing two iterators. In order to implement slice(), you'd need
> to iterate over the list, counting the items, then detach, find the new
> two iterators, then do the slice(). That makes an O(M) operation into an
> O(2N) operation, M being the number of sliced entries (it was O(1) in
> C++98), N the size of the list.
But that happens only if you detach; otherwise the performance should be
comparable to std::list. That detaching has a high cost is a known fact.
http://www.mardy.it - Geek in un lingua international
More information about the Development