Commit f9e21e9
committed
std::unique_ptr baby
Captures in lambdas are const by default. So in order to
be able to move from them, we mark the entire lambda
as mutable. Thus, member variables in our closure object
are no longer const. Also, using a variable multiple times
on the same line and one of the uses is modifying the
variable is a no-no. Extract the pointer out of the unique_ptr
before performing modifying operation.1 parent 4a73735 commit f9e21e9
1 file changed
Lines changed: 7 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
42 | | - | |
43 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
| |||
0 commit comments