I've encountered an issue where, although
g.run( f );
will compile fine,
g.run_and_wait( f );
causes my build to fail. The 'f' variable is an instance of a class with a defined public operator()(). The issue doesn't arise if I wrap 'f' away in a lambda. The issue seems to have something to do with const-correctness. Is this intended?
I've attached a small program which demonstrates the problem. I've tested only in Visual Studio 2010.
Yes, that's correct. The implementation of task group interface requires the user's functor to be cv-qualified as 'const'. Please see the details in the documentation available at https://www.threadingbuildingblocks.org/docs/help/reference/task_groups.htm
The reason why it works using lambda-based approach is because the lambda functions are implicitly declared with such 'const' qualifier by default, as far as I know.
You are welcome!
Yes, forum is used to discuss issues, for technical support, or to report bugs. In addition, one could go further and submit a contribution (using https://www.threadingbuildingblocks.org/submit-contribution) to fix the suspected bug.