[DiscordArchive] the reason why you set the lambda as mutable is because targets is const and you updated them at off
[DiscordArchive] the reason why you set the lambda as mutable is because targets is const and you updated them at off
Archived author: Telegrill • Posted: 2025-01-15T23:31:23.010000+00:00
Original source
the reason why you set the lambda as mutable is because targets is const and you updated them at offset, right?
Archived author: Telegrill • Posted: 2025-01-15T23:32:17.818000+00:00
Original source
I assume the code wouldn't let you call Update at all without mutable
Archived author: Telegrill • Posted: 2025-01-15T23:32:39.810000+00:00
Original source
since the variable is captured by value?
Archived author: Tea • Posted: 2025-01-15T23:37:48.831000+00:00
Original source
basically lambda compiles to this
Archived author: Tea • Posted: 2025-01-15T23:37:52.781000+00:00
Original source
```
struct Lambda
{
auto operator()() const
{
// body
}
Capture1 _1;
Capture2 _2;
// ...
}
```
Archived author: Tea • Posted: 2025-01-15T23:37:59.877000+00:00
Original source
notice the const on the function
Archived author: Tea • Posted: 2025-01-15T23:38:04.077000+00:00
Original source
its there by default
Archived author: Tea • Posted: 2025-01-15T23:38:07.794000+00:00
Original source
mutable removes it
Archived author: Tea • Posted: 2025-01-15T23:38:32.038000+00:00
Original source
which lets you call non-const marked member functions of captured variables
Archived author: Telegrill • Posted: 2025-01-15T23:39:52.472000+00:00
Original source
I see, that makes sense