diff --git a/cpp/full_code/pressure_stats.cpp b/cpp/full_code/pressure_stats.cpp index 499dd406ffb6d35a045bf937dbf8776adbfebbdc..902db331b61f8f6a5bf32266c254e9b2b96b8166 100644 --- a/cpp/full_code/pressure_stats.cpp +++ b/cpp/full_code/pressure_stats.cpp @@ -148,7 +148,13 @@ int pressure_stats<rnumber>::work_on_current_iteration(void) else stat_group = 0; - /// define local "compute scalar stats" function + /// define local "compute scalar stats" lambda function + /// it can't be a simple function, C++ doesn't allow that. + /// however, we want a simple function here because this whole block + /// consists of code that must be identical when applied to different + /// versions of the velocity field (i.e. vel field differently filtered). + /// luckily, C++11 allows lambda functions. + /// we must explicitly pass the "this" and "stat_group" names to the lambda function. auto compute_stats_for_cvelocity = [this, stat_group](std::string stat_prefix) { /// set scalar to 0