aboutsummaryrefslogtreecommitdiffstats
path: root/src/checks/level1/README-range-loop.md
blob: ef9d4eda9d4a2ed02c2a3cf3b41bff5747ccb118 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
# range-loop

Finds places where you're using C++11 range-loops with non-const Qt containers (potential detach).

Fix it by marking the container const, or, since Qt 5.7, use `qAsConst()`:

#### Example

`for (auto i : qAsConst(list)) { ... }`

Also warns if you're passing structs with non-trivial copy-ctor or non-trivial dtor by value, use
const-ref so that the copy-ctor and dtor don't get called.