Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
concurrent_vector::operator[] Operator

concurrent_vector::operator[] Operator

Provides access to the element at the given index in the concurrent vector. This method is concurrency-safe for read operations, and also while growing the vector, as long as the you have ensured that the value _Index is less than the size of the concurrent vector.

reference operator[](
   size_type _Index
);
const_reference operator[](
   size_type _Index
) const;

_Index

The index of the element to be retrieved.

A reference to the item at the given index.

The version of operator [] that returns a non-const refernce cannot be used to concurrently write to the element from different threads. A different synchronization object should be used to synchronize concurrent read and write operations to the same data element.

No bounds checking is performed to ensure that _Index is a valid index into the concurrent vector.

Header: concurrent_vector.h

Namespace: Concurrency

Community Additions

ADD
Show:
© 2015 Microsoft