File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 3
3
bugprone-default-lambda-capture
4
4
===============================
5
5
6
- Warns when lambda expressions use default capture modes (``[=] `` or ``[&] ``)
7
- instead of explicitly capturing specific variables. Default captures can make
8
- code less readable and more error-prone by making it unclear which variables
9
- are being captured and how.
6
+ Finds lambda expressions that use default capture modes (``[=] `` or ``[&] ``)
7
+ and suggests using explicit captures instead. Default captures can lead to
8
+ subtle bugs including dangling references with ``[&] ``, unnecessary copies
9
+ with ``[=] ``, and make code less maintainable by hiding which variables are
10
+ actually being captured.
10
11
11
12
Implements Item 31 of Effective Modern C++ by Scott Meyers.
12
13
You can’t perform that action at this time.
0 commit comments