The const-reference API to DoNotOptimize was deprecated with #1493. Some examples in the user guide are using exactly that deprecated interface. This fixes that by passing non-const lvalues instead. Fixes #1566
I tried to provide a brief comment explaining why a copy is passed to DoNotOptimize. I opted to do so only in the section that addresses the DoNotOptimize feature directly, to not clutter the examples that highlight other aspects too much. I do wonder whether a more elaborate explanation in the "Preventing Optimization" section might be warranted, but perhaps that is for another PR?
The const-reference API to
DoNotOptimize
was deprecated with #1493. Some examples in the user guide are using exactly that deprecated interface. This fixes that by passing non-const lvalues instead. Fixes #1566I tried to provide a brief comment explaining why a copy is passed to
DoNotOptimize
. I opted to do so only in the section that addresses theDoNotOptimize
feature directly, to not clutter the examples that highlight other aspects too much. I do wonder whether a more elaborate explanation in the "Preventing Optimization" section might be warranted, but perhaps that is for another PR?