Concurrent Growth

The methods described in the following table may be invoked concurrently on the same vector.
Member Description
iterator grow_by( size_type delta, const_reference t=T() )

Appends a sequence comprising delta copies of t to the end of the vector. If t is not specified, the new elements are default constructed.

Returns: Iterator pointing to beginning of appended sequence.

Note

Return type was size_type in Intel® Threading Building Blocks (Intel® TBB) 2.1.

iterator grow_to_at_least( size_type n )

Appends minimal sequence of elements such that vector.size()>=n. The new elements are default constructed. Blocks until all elements in range [0..n) are allocated (but not necessarily constructed if they are under construction by a different thread).

Tip

If a thread must know whether construction of an element has completed, consider the following technique. Instantiate the concurrent_vector using a zero_allocator. Define the constructor T() such that when it completes, it sets a field of T to non-zero. A thread can check whether an item in the concurrent_vector is constructed by checking whether the field is non-zero.

Returns: Iterator that points to beginning of appended sequence, or pointer to (*this)[n] if no elements were appended.

Note

Return type was void in Intel® TBB 2.1.

iterator push_back( const_reference value )

Appends copy of value to the end of the vector.

Returns Iterator that points to the copy.

Note

Return type was size_type in Intel® TBB 2.1.