diff options
Diffstat (limited to 'docs/checks/README-range-loop.md')
-rw-r--r-- | docs/checks/README-range-loop.md | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/checks/README-range-loop.md b/docs/checks/README-range-loop.md new file mode 100644 index 00000000..ef9d4eda --- /dev/null +++ b/docs/checks/README-range-loop.md @@ -0,0 +1,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. |