[clazy] [Bug 389056] New: suggest using initializer lists
Milian Wolff
bugzilla_noreply at kde.org
Tue Jan 16 14:22:04 GMT 2018
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: unassigned-bugs at kde.org
Reporter: mail at milianw.de
CC: smartins at kde.org
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 the assignee for the bug.
More information about the Unassigned-bugs
mailing list