The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

250216 (1) [Avatar] Offline
The code in listing 3.1.2 is used to explain when to use mutable as part of the lambda-declarator. However, I believe there is an error in this example; it does not need to marked mutable. Only when one wishes to modify a variable that has been captured by value does one need to use mutable.

I have verified that the code, modified by removing the mutable keyword, compiles under the current versions of GCC, clang, and MSV++.

I believe the relevant portions of the C++14 standard are section 5.1.2, paragraphs 5, 15 and 16.
Ivan Cukic (104) [Avatar] Offline
It should be fixed now. Thanks for reporting.