From: Daniel Arndt Date: Wed, 9 Oct 2019 04:33:43 +0000 (-0400) Subject: Rework lambda description a bit, mention capture defaults X-Git-Tag: v9.2.0-rc1~966^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84e67469ab4831c9314d62150e5adbd4148f3ecc;p=dealii.git Rework lambda description a bit, mention capture defaults --- diff --git a/examples/step-13/step-13.cc b/examples/step-13/step-13.cc index 5fe1fb1cc0..71cf392ecb 100644 --- a/examples/step-13/step-13.cc +++ b/examples/step-13/step-13.cc @@ -756,7 +756,7 @@ namespace Step13 AssemblyCopyData()); linear_system.hanging_node_constraints.condense(linear_system.matrix); - // The syntax above using lambda functions requires + // The syntax above requires // some explanation. There are multiple version of // WorkStream::run that expect different arguments. In step-9, // we used one version that took a pair of iterators, a pair of @@ -790,11 +790,15 @@ namespace Step13 // typical way to generate such function objects is using a // lambda // function that wraps the function call including the individual - // arguments with fixed values. The fixed values are passed into the - // lambda function using the capture list - // (`[...]`). All the other arguments the wrapped function requires and are - // part of the outer function signature are specified as regular function - // parameters in the lambda function. + // arguments with fixed values. All the arguments that are part of the + // outer function signature are specified as regular function arguments in + // the lambda function. The fixed values are passed into the lambda + // function using the capture list (`[...]`). It is possible to use a + // capture default or to list all the variables that are to be bound to + // the lambda explicitly. For the sake of clarity we decided to to omit + // the capture default here, but that capture list could equally well be + // `[&]` meaning that all used variables are copied into the lambda by + // reference. // // At this point, we have assembled the matrix and condensed // it. The right hand side may or may not have been completely