From 72e1bb545b3f5848f052ed9299d63e5589019f7b Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 18 Oct 2019 10:51:11 -0600 Subject: [PATCH] Be more explicit about the Copied argument to WorkStream::run(). --- include/deal.II/base/work_stream.h | 36 +++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/include/deal.II/base/work_stream.h b/include/deal.II/base/work_stream.h index c2664c39e2..31e06c848b 100644 --- a/include/deal.II/base/work_stream.h +++ b/include/deal.II/base/work_stream.h @@ -929,8 +929,16 @@ namespace WorkStream * are generated. * * @note In case the copier does not do anything, pass - * std::function() as @p copier to make sure - * a more efficient algorithm is used internally. + * `std::function()` as @p copier to make sure + * a more efficient algorithm is used internally. It is important, however, + * to recognize that the empty function object created above is *not* + * the same as a lambda function with an empty body, + * `[](const CopyData &) {}` -- from the perspective of this function, + * there is no way to recognize whether a lambda function provided as + * a copier does something or does not do something in its body, + * and so it needs to be copied. On the other hand, a default-constructed + * `std::function` object *can* be recognized, and is then used to select + * a more efficient algorithm. */ template std::function() as @p copier to make sure - * a more efficient algorithm is used internally. + * `std::function()` as @p copier to make sure + * a more efficient algorithm is used internally. It is important, however, + * to recognize that the empty function object created above is *not* + * the same as a lambda function with an empty body, + * `[](const CopyData &) {}` -- from the perspective of this function, + * there is no way to recognize whether a lambda function provided as + * a copier does something or does not do something in its body, + * and so it needs to be copied. On the other hand, a default-constructed + * `std::function` object *can* be recognized, and is then used to select + * a more efficient algorithm. */ template std::function() as @p copier to make sure - * a more efficient algorithm is used internally. + * `std::function()` as @p copier to make sure + * a more efficient algorithm is used internally. It is important, however, + * to recognize that the empty function object created above is *not* + * the same as a lambda function with an empty body, + * `[](const CopyData &) {}` -- from the perspective of this function, + * there is no way to recognize whether a lambda function provided as + * a copier does something or does not do something in its body, + * and so it needs to be copied. On the other hand, a default-constructed + * `std::function` object *can* be recognized, and is then used to select + * a more efficient algorithm. */ template