- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello all.
Strange problem, I created a class to be used with tbb_thread, and I noticed that the copy constructor was being called. This doesn't make sense for my class, because I'm performing some initialization that should be done once... I was taken by surprise that the object was being copied.
Might I suggest that "F" inside of the tbb_thread templates should be F&? Thus the copy constructor won't be needed?
AJ
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Like this the choice is yours to pass a proxy or perhaps even a stateless object.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"Like this the choice is yours to pass a proxy or perhaps even a stateless object." With an argument specifying the state, I mean, for the second option. As for a rationale, the more prevalent use cases would otherwise be inconvenienced by requiring an argument, which here is only a possible implementation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"Like this the choice is yours to pass a proxy or perhaps even a stateless object." With an argument specifying the state, I mean, for the second option. As for a rationale, the more prevalent use cases would otherwise be inconvenienced by requiring an argument, which here is only a possible implementation.
Agreed, use a reference wrapper class ifnecessary. That's what I use for other situations, not this one in particular, because normally you don't want two threads sharing F anyways,especiallyif F has state.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page