Condividi tramite


concurrent_vector Class

The concurrent_vector class is a sequence container class that allows random access to any element. It enables concurrency-safe append, element access, iterator access, and iterator traversal operations.

template<
   typename _Ty,
   class _Ax
>
class concurrent_vector: protected details::_Allocator_base<_Ty, _Ax>, private details::_Concurrent_vector_base_v4;

Parameters

  • _Ty
    The data type of the elements to be stored in the vector.

  • _Ax
    The type that represents the stored allocator object that encapsulates details about the allocation and deallocation of memory for the concurrent vector. This argument is optional and the default value is allocator<_Ty**>**.

Members

Public Typedefs

Name

Description

allocator_type

A type that represents the allocator class for the concurrent vector.

const_iterator

A type that provides a random-access iterator that can read a const element in a concurrent vector.

const_pointer

A type that provides a pointer to a const element in a concurrent vector.

const_reference

A type that provides a reference to a const element stored in a concurrent vector for reading and performing const operations.

const_reverse_iterator

A type that provides a random-access iterator that can read any const element in the concurrent vector.

difference_type

A type that provides the signed distance between two elements in a concurrent vector.

iterator

A type that provides a random-access iterator that can read any element in a concurrent vector. Modification of an element using the iterator is not concurrency-safe.

pointer

A type that provides a pointer to an element in a concurrent vector.

reference

A type that provides a reference to an element stored in a concurrent vector.

reverse_iterator

A type that provides a random-access iterator that can read any element in a reversed concurrent vector. Modification of an element using the iterator is not concurrency-safe.

size_type

A type that counts the number of elements in a concurrent vector.

value_type

A type that represents the data type stored in a concurrent vector.

Public Constructors

Name

Description

concurrent_vector::concurrent_vector Constructor

Overloaded. Constructs a concurrent vector.

concurrent_vector::~concurrent_vector Destructor

Erases all elements and destroys this concurrent vector.

Public Methods

Name

Description

concurrent_vector::assign Method

Overloaded. Erases the elements of the concurrent vector and assigns to it either _N copies of _Item, or values specified by the iterator range [_Begin, _End). This method is not concurrency-safe.

concurrent_vector::at Method

Overloaded. 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 you have ensured that the value _Index is less than the size of the concurrent vector.

concurrent_vector::back Method

Overloaded. Returns a reference or a const reference to the last element in the concurrent vector. If the concurrent vector is empty, the return value is undefined. This method is concurrency-safe.

concurrent_vector::begin Method

Overloaded. Returns an iterator of type iterator or const_iterator to the beginning of the concurrent vector. This method is concurrency-safe.

concurrent_vector::capacity Method

Returns the maximum size to which the concurrent vector can grow without having to allocate more memory. This method is concurrency-safe.

concurrent_vector::cbegin Method

Returns an iterator of type const_iterator to the beginning of the concurrent vector. This method is concurrency-safe.

concurrent_vector::cend Method

Returns an iterator of type const_iterator to the end of the concurrent vector. This method is concurrency-safe.

concurrent_vector::clear Method

Erases all elements in the concurrent vector. This method is not concurrency-safe.

concurrent_vector::crbegin Method

Returns an iterator of type const_reverse_iterator to the beginning of the concurrent vector. This method is concurrency-safe.

concurrent_vector::crend Method

Returns an iterator of type const_reverse_iterator to the end of the concurrent vector. This method is concurrency-safe.

concurrent_vector::empty Method

Tests if the concurrent vector is empty at the time this method is called. This method is concurrency-safe.

concurrent_vector::end Method

Overloaded. Returns an iterator of type iterator or const_iterator to the end of the concurrent vector. This method is concurrency-safe.

concurrent_vector::front Method

Overloaded. Returns a reference or a const reference to the first element in the concurrent vector. If the concurrent vector is empty, the return value is undefined. This method is concurrency-safe.

concurrent_vector::get_allocator Method

Returns a copy of the allocator used to construct the concurrent vector. This method is concurrency-safe.

concurrent_vector::grow_by Method

Overloaded. Grows this concurrent vector by _Delta elements. This method is concurrency-safe.

concurrent_vector::grow_to_at_least Method

Grows this concurrent vector until it has at least _N elements. This method is concurrency-safe.

concurrent_vector::max_size Method

Returns the maximum number of elements the concurrent vector can hold. This method is concurrency-safe.

concurrent_vector::push_back Method

Overloaded. Appends the given item to the end of the concurrent vector. This method is concurrency-safe.

concurrent_vector::rbegin Method

Overloaded. Returns an iterator of type reverse_iterator or const_reverse_iterator to the beginning of the concurrent vector. This method is concurrency-safe.

concurrent_vector::rend Method

Overloaded. Returns an iterator of type reverse_iterator or const_reverse_iterator to the end of the concurrent vector. This method is concurrency-safe.

concurrent_vector::reserve Method

Allocates enough space to grow the concurrent vector to size _N without having to allocate more memory later. This method is not concurrency-safe.

concurrent_vector::resize Method

Overloaded. Changes the size of the concurrent vector to the requested size, deleting or adding elements as necessary. This method is not concurrency-safe.

concurrent_vector::shrink_to_fit Method

Compacts the internal representation of the concurrent vector to reduce fragmentation and optimize memory usage. This method is not concurrency-safe.

concurrent_vector::size Method

Returns the number of elements in the concurrent vector. This method is concurrency-safe.

concurrent_vector::swap Method

Swaps the contents of two concurrent vectors. This method is not concurrency-safe.

Public Operators

Name

Description

concurrent_vector::operator[] Operator

Overloaded. 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.

concurrent_vector::operator= Operator

Overloaded. Assigns the contents of another concurrent_vector object to this one. This method is not concurrency-safe.

Remarks

For detailed information on the concurrent_vector class, see Parallel Containers and Objects.

Inheritance Hierarchy

_Concurrent_vector_base_v4

_Allocator_base

concurrent_vector

Requirements

Header: concurrent_vector.h

Namespace: concurrency

See Also

Reference

concurrency Namespace

Concepts

Parallel Containers and Objects