- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The first fragment I quoted above does compile, though.
Shouldn't the rules apply equally to run and run_and_wait?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
They should. Thank you for reporting discrepancies!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My pleasure.
Just so I'm clear, is creating a new forum thread the best way to report suspected bugs?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page