oneTBB icon indicating copy to clipboard operation
oneTBB copied to clipboard

Fix incorrect value_type for concurrent_[unordered_]set::iterator

Open kboyarinov opened this issue 2 years ago • 0 comments

Description

Fix an issue in concurrent_set and concurrent_unordered_set - iterator types should be constant for these classes. Current implementation allows to write the following:

oneapi::tbb::concurrent_set<int> s = {1, 2, 3};
*s.begin() = 42;
// Now s is {42, 2, 3} - elements ordering is broken

The code above can brake elements ordering for ordered containers and place wrong elements into buckets for unordered.

Fixes # - issue number(s) if exists

  • [x] - git commit message contains an appropriate signed-off-by string (see CONTRIBUTING.md for details)

Type of change

Choose one or multiple, leave empty if none of the other choices apply

Add a respective label(s) to PR if you have permissions

  • [x] bug fix - change that fixes an issue
  • [ ] new feature - change that adds functionality
  • [ ] tests - change in tests
  • [ ] infrastructure - change in infrastructure and CI
  • [ ] documentation - documentation update

Tests

  • [x] added - required for new features and some bug fixes
  • [ ] not needed

Documentation

  • [ ] updated in # - add PR number
  • [ ] needs to be updated
  • [x] not needed

Breaks backward compatibility

  • [ ] Yes
  • [x] No
  • [ ] Unknown

Notify the following users

List users with @ to send notifications

Other information

kboyarinov avatar Jan 17 '23 14:01 kboyarinov