- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following piece of code runs well:
atomic a;
a = 0.1;
cout<< a.fetch_and_store(0.2);
cout<<
The following piece does not compile(error: struct tbb::atomic has no member named fetch_and_add):
atomic a;
a = 0.1;
cout< < a.fetch_and_store(0.2);
cout<< a.fetch_and_add(0.3);
cout<<
Anyone know whether current tbb support float/double for fetch_and_add or not?
Thanks!
atomic
a = 0.1;
cout<<
cout<<
The following piece does not compile(error: struct tbb::atomic
atomic
a = 0.1;
cout<
cout<<
cout<<
Anyone know whether current tbb support float/double for fetch_and_add or not?
Thanks!
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That would be nice and orthogonal, but neither TBB nor C++11 provide arithmetic operations for floating-point types, so they require you to cobble those together yourself (note that with TBB you'll have to be extra careful when evaluating the result of compare_and_swap, as plus zero and minus zero are different bit patterns but compare as equal for the equality operator).

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page