QFlatMap: avoid post-(in|de)crement on iterators
Generic code needs to avoid post-increment and -decrement, because they're less efficient than pre-increment and -decrement when implemented in class types as opposed to scalars (extra copy necessary). Use the common pattern of implementing post- using pre-increment. Pick-to: 6.3 Change-Id: Ida38df04c6c6f877453e5b3a1983457cc7f63f11 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
878aea3645
commit
88fd9a281a
@ -191,7 +191,7 @@ public:
|
||||
{
|
||||
|
||||
iterator r = *this;
|
||||
i++;
|
||||
++*this;
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -204,7 +204,7 @@ public:
|
||||
iterator operator--(int)
|
||||
{
|
||||
iterator r = *this;
|
||||
i--;
|
||||
--*this;
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -328,7 +328,7 @@ public:
|
||||
{
|
||||
|
||||
const_iterator r = *this;
|
||||
i++;
|
||||
++*this;
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -341,7 +341,7 @@ public:
|
||||
const_iterator operator--(int)
|
||||
{
|
||||
const_iterator r = *this;
|
||||
i--;
|
||||
--*this;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user