It depends on what other threads are doing.
From the standard:
17.6.5.9 Data Race Evasion [res.on.data.races]
...
2 The standard C ++ library function should not directly or indirectly access objects (1.10) that are accessible by streams other than the current stream if objects are directly or indirectly accessed through function arguments, including this.
3 The standard C ++ library function should not directly or indirectly modify objects (1.10) accessible by flows other than the current stream if objects are accessed directly or indirectly through functions that are not constant arguments, including this.
and
23.2.2 Racing container data [container.requirements.dataraces]
1 In order to avoid data investigations (17.6.5.9), implementations should take into account the following functions: const: start, end, rbegin, rend, front, back, data, find, lower_bound, upper_bound, equal_range, at and, with the exception of associative or disordered associative containers, operator [].
2 Despite (17.6.5.9), implementations are necessary to avoid data investigations when the contents of the contained object in different elements in the same container, except for the <bool> vector, are modified simultaneously.
By combining these two parts with the rules of atomatics, we can conclude that a call to vec[index].fetch_add(1, std::memory_order_release) cannot cause a race condition with other threads that perform the same or different "const" operations (including those specified in paragraph 23.2.2.1). However, if another thread calls a non-const operation on the vec itself (for example, insert , erase , resize , etc.), then we perform undefined behavior, as described in section 1.10:
1.10 Multithreaded Executions and Data Schedules [intro.multithread]
...
4 Two evaluations of expressions conflict if one of them changes the memory location (1.7), and the other accesses or changes the same memory location.
...
21 A program execution contains a data race if it contains two conflicting actions in different threads, at least one of which is not atomic, and the other does not occur. Any such data race results in undefined.