37 lines
1.6 KiB
Markdown
37 lines
1.6 KiB
Markdown
[container.requirements.dataraces]
|
||
|
||
# 23 Containers library [[containers]](./#containers)
|
||
|
||
## 23.2 Requirements [[container.requirements]](container.requirements#dataraces)
|
||
|
||
### 23.2.3 Container data races [container.requirements.dataraces]
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L1288)
|
||
|
||
For purposes of avoiding data races ([[res.on.data.races]](res.on.data.races "16.4.6.10 Data race avoidance")), implementations shall
|
||
consider the following functions to be const: begin, end,rbegin, rend, front, back, data, find,lower_bound, upper_bound, equal_range, at and, except in
|
||
associative or unordered associative containers, operator[][.](#1.sentence-1)
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L1295)
|
||
|
||
Notwithstanding [[res.on.data.races]](res.on.data.races "16.4.6.10 Data race avoidance"), implementations are required to avoid data
|
||
races when the contents of the contained object in different elements in the same
|
||
container, excepting vector<bool>, are modified concurrently[.](#2.sentence-1)
|
||
|
||
[3](#3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L1300)
|
||
|
||
[*Note [1](#note-1)*:
|
||
|
||
For a vector<int> x with a size greater than one, x[1] = 5 and *x.begin() = 10 can be executed concurrently without a data race, butx[0] = 5 and *x.begin() = 10 executed concurrently can result in a data
|
||
race[.](#3.sentence-1)
|
||
|
||
As an exception to the general rule, for a vector<bool> y, y[0] = true can race with y[1] = true[.](#3.sentence-2)
|
||
|
||
â *end note*]
|