1.. title:: clang-tidy - performance-for-range-copy
2
3performance-for-range-copy
4==========================
5
6Finds C++11 for ranges where the loop variable is copied in each iteration but
7it would suffice to obtain it by const reference.
8
9The check is only applied to loop variables of types that are expensive to copy
10which means they are not trivially copyable or have a non-trivial copy
11constructor or destructor.
12
13To ensure that it is safe to replace the copy with a const reference the
14following heuristic is employed:
15
161. The loop variable is const qualified.
172. The loop variable is not const, but only const methods or operators are
18   invoked on it, or it is used as const reference or value argument in
19   constructors or function calls.
20
21Options
22-------
23
24.. option:: WarnOnAllAutoCopies
25
26   When `true`, warns on any use of `auto` as the type of the range-based for
27   loop variable. Default is `false`.
28
29.. option:: AllowedTypes
30
31   A semicolon-separated list of names of types allowed to be copied in each
32   iteration. Regular expressions are accepted, e.g. `[Rr]ef(erence)?$` matches
33   every type with suffix `Ref`, `ref`, `Reference` and `reference`. The default
34   is empty.
35