https://bugs.kde.org/show_bug.cgi?id=389056
Bug ID: 389056
Summary: suggest using initializer lists
Product: clazy
Version: unspecified
Platform: Other
OS: Linux
Status: UNCONFIRMED
Severity: normal
Priority: NOR
Component: general
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Target Milestone: ---
I often come across code like this which is bad, from a performance POV:
```
QVector<Type> l1 = ...;
QVector<Type> l2 = ...;
foreach(const auto& item : l1 + l2) { ... }
```
Instead, it would be faster to use a lambda or a nested loop to get rid of the
temporary allocation. E.g.:
```
QVector<Type> l1 = ...;
QVector<Type> l2 = ...;
for (const auto& list : {l1, l2}) {
for (const auto& item : list) { ... }
}
```
--
You are receiving this mail because:
You are watching all bug changes.