Udostępnij za pośrednictwem


concurrent_vector::resize Method

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

void resize(
   size_type _N
);
void resize(
   size_type _N,
   const _Ty& _Val
);

Parameters

  • _N
    The new size of the concurrent vector.

  • _Val
    The value of new elements added to the vector if the new size is larger that the original size. If the value is omitted, the new objects are assigned the default value for their type.

Remarks

If the size of the container is less than the requested size, elements are added to the vector until it reaches the requested size. If the size of the container is larger than the requested size, the elements closest to the end of the container are deleted until the container reaches the size _N. If the present size of the container is the same as the requested size, no action is taken.

resize is not concurrency safe. You must ensure that no other threads are invoking methods on the concurrent vector when you call this method.

Requirements

Header: concurrent_vector.h

Namespace: Concurrency

See Also

Reference

concurrent_vector Class