STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Friends | List of all members
Concurrency::concurrent_vector< _Ty, _Ax > Class Template Reference

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

#include <concurrent_vector.h>

Inheritance diagram for Concurrency::concurrent_vector< _Ty, _Ax >:
Concurrency::details::_Allocator_base< _Ty, _Ax > Concurrency::details::_Concurrent_vector_base_v4

Classes

class  _Internal_loop_guide
 
class  _Is_integer_tag
 

Public Types

typedef details::_Concurrent_vector_base_v4::_Size_type size_type
 A type that counts the number of elements in a concurrent vector. More...
 
typedef details::_Allocator_base< _Ty, _Ax >::_Allocator_type allocator_type
 A type that represents the allocator class for the concurrent vector. More...
 
typedef _Ty value_type
 A type that represents the data type stored in a concurrent vector. More...
 
typedef ptrdiff_t difference_type
 A type that provides the signed distance between two elements in a concurrent vector. More...
 
typedef _Ty & reference
 A type that provides a reference to an element stored in a concurrent vector. More...
 
typedef const _Ty & const_reference
 A type that provides a reference to a const element stored in a concurrent vector for reading and performing const operations. More...
 
typedef _Ty * pointer
 A type that provides a pointer to an element in a concurrent vector. More...
 
typedef const _Ty * const_pointer
 A type that provides a pointer to a const element in a concurrent vector. More...
 
typedef details::_Vector_iterator< concurrent_vector, _Ty > 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. More...
 
typedef details::_Vector_iterator< concurrent_vector, const _Ty > const_iterator
 A type that provides a random-access iterator that can read a const element in a concurrent vector. More...
 
typedef std::reverse_iterator< iteratorreverse_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. More...
 
typedef std::reverse_iterator< const_iteratorconst_reverse_iterator
 A type that provides a random-access iterator that can read any const element in the concurrent vector. More...
 

Public Member Functions

 concurrent_vector (const allocator_type &_Al=allocator_type())
 Constructs a concurrent vector. More...
 
 concurrent_vector (const concurrent_vector &_Vector)
 Constructs a concurrent vector. More...
 
template<class M >
 concurrent_vector (const concurrent_vector< _Ty, M > &_Vector, const allocator_type &_Al=allocator_type())
 Constructs a concurrent vector. More...
 
 concurrent_vector (concurrent_vector &&_Vector)
 Constructs a concurrent vector. More...
 
 concurrent_vector (size_type _N)
 Constructs a concurrent vector. More...
 
 concurrent_vector (size_type _N, const_reference _Item, const allocator_type &_Al=allocator_type())
 Constructs a concurrent vector. More...
 
template<class _InputIterator >
 concurrent_vector (_InputIterator _Begin, _InputIterator _End, const allocator_type &_Al=allocator_type())
 Constructs a concurrent vector. More...
 
concurrent_vectoroperator= (const concurrent_vector &_Vector)
 Assigns the contents of another concurrent_vector object to this one. This method is not concurrency-safe. More...
 
template<class M >
concurrent_vectoroperator= (const concurrent_vector< _Ty, M > &_Vector)
 Assigns the contents of another concurrent_vector object to this one. This method is not concurrency-safe. More...
 
concurrent_vectoroperator= (concurrent_vector &&_Vector)
 Assigns the contents of another concurrent_vector object to this one. This method is not concurrency-safe. More...
 
iterator grow_by (size_type _Delta)
 Grows this concurrent vector by _Delta elements. This method is concurrency-safe. More...
 
iterator grow_by (size_type _Delta, const_reference _Item)
 Grows this concurrent vector by _Delta elements. This method is concurrency-safe. More...
 
iterator grow_to_at_least (size_type _N)
 Grows this concurrent vector until it has at least _N elements. This method is concurrency-safe. More...
 
iterator push_back (const_reference _Item)
 Appends the given item to the end of the concurrent vector. This method is concurrency-safe. More...
 
iterator push_back (_Ty &&_Item)
 Appends the given item to the end of the concurrent vector. This method is concurrency-safe. More...
 
reference operator[] (size_type _Index)
 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. More...
 
const_reference operator[] (size_type _Index) const
 Provides read access to 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. More...
 
reference at (size_type _Index)
 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. More...
 
const_reference at (size_type _Index) const
 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. More...
 
size_type size () const
 Returns the number of elements in the concurrent vector. This method is concurrency-safe. More...
 
bool empty () const
 Tests if the concurrent vector is empty at the time this method is called. This method is concurrency-safe. More...
 
size_type capacity () const
 Returns the maximum size to which the concurrent vector can grow without having to allocate more memory. This method is concurrency-safe. More...
 
void reserve (size_type _N)
 Allocates enough space to grow the concurrent vector to size _N without having to allocate more memory later. This method is not concurrency-safe. More...
 
void shrink_to_fit ()
 Compacts the internal representation of the concurrent vector to reduce fragmentation and optimize memory usage. This method is not concurrency-safe. More...
 
void resize (size_type _N)
 Changes the size of the concurrent vector to the requested size, deleting or adding elements as necessary. This method is not concurrency-safe. More...
 
void resize (size_type _N, const _Ty &_Val)
 Changes the size of the concurrent vector to the requested size, deleting or adding elements as necessary. This method is not concurrency-safe. More...
 
size_type max_size () const
 Returns the maximum number of elements the concurrent vector can hold. This method is concurrency-safe. More...
 
iterator begin ()
 Returns an iterator of type iterator or const_iterator to the beginning of the concurrent vector. This method is concurrency-safe. More...
 
iterator end ()
 Returns an iterator of type iterator or const_iterator to the end of the concurrent vector. This method is concurrency-safe. More...
 
const_iterator begin () const
 Returns an iterator of type iterator or const_iterator to the beginning of the concurrent vector. This method is concurrency-safe. More...
 
const_iterator end () const
 Returns an iterator of type iterator or const_iterator to the end of the concurrent vector. This method is concurrency-safe. More...
 
reverse_iterator rbegin ()
 Returns an iterator of type reverse_iterator or const_reverse_iterator to the beginning of the concurrent vector. This method is concurrency-safe. More...
 
reverse_iterator rend ()
 Returns an iterator of type reverse_iterator or const_reverse_iterator to the end of the concurrent vector. This method is concurrency-safe. More...
 
const_reverse_iterator rbegin () const
 Returns an iterator of type reverse_iterator or const_reverse_iterator to the beginning the concurrent vector. This method is concurrency-safe. More...
 
const_reverse_iterator rend () const
 Returns an iterator of type reverse_iterator or const_reverse_iterator to the end of the concurrent vector. This method is concurrency-safe. More...
 
const_iterator cbegin () const
 Returns an iterator of type const_iterator to the beginning of the concurrent vector. This method is concurrency-safe. More...
 
const_iterator cend () const
 Returns an iterator of type const_iterator to the end of the concurrent vector. This method is concurrency-safe. More...
 
const_reverse_iterator crbegin () const
 Returns an iterator of type const_reverse_iterator to the beginning of the concurrent vector. This method is concurrency-safe. More...
 
const_reverse_iterator crend () const
 Returns an iterator of type const_reverse_iterator to the end of the concurrent vector. This method is concurrency-safe. More...
 
reference front ()
 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. More...
 
const_reference front () const
 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. More...
 
reference back ()
 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. More...
 
const_reference back () const
 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. More...
 
allocator_type get_allocator () const
 Returns a copy of the allocator used to construct the concurrent vector. This method is concurrency-safe. More...
 
void assign (size_type _N, const_reference _Item)
 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. More...
 
template<class _InputIterator >
void assign (_InputIterator _Begin, _InputIterator _End)
 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. More...
 
void swap (concurrent_vector &_Vector)
 Swaps the contents of two concurrent vectors. This method is not concurrency-safe. More...
 
void clear ()
 Erases all elements in the concurrent vector. This method is not concurrency-safe. More...
 
 ~concurrent_vector ()
 Erases all elements and destroys this concurrent vector. More...
 
const ::Concurrency::details::_Concurrent_vector_base_v4_Internal_vector_base () const
 
::Concurrency::details::_Concurrent_vector_base_v4_Internal_vector_base ()
 

Private Types

typedef concurrent_vector< _Ty, _Ax > _Myt
 
- Private Types inherited from Concurrency::details::_Concurrent_vector_base_v4
typedef size_t _Segment_index_t
 
typedef size_t _Size_type
 
typedef void(__cdecl * _My_internal_array_op1) (void *_Begin, _Size_type _N)
 
typedef void(__cdecl * _My_internal_array_op2) (void *_Dst, const void *_Src, _Size_type _N)
 

Private Member Functions

void _Internal_free_segments (void *_Table[], _Segment_index_t _K, _Segment_index_t _First_block)
 
_Ty & _Internal_subscript (size_type _Index) const
 
_Ty & _Internal_subscript_with_exceptions (size_type _Index) const
 
void _Internal_assign (size_type _N, const_reference _Item)
 
template<class _I >
void _Internal_assign (_I _First, _I _Last, _Is_integer_tag< true > *)
 
template<class _I >
void _Internal_assign (_I _First, _I _Last, _Is_integer_tag< false > *)
 
template<class _I >
void internal_assign_iterators (_I _First, _I _Last)
 
- Private Member Functions inherited from Concurrency::details::_Concurrent_vector_base_v4
void *__cdecl * _My_vector_allocator_ptr (_Concurrent_vector_base_v4 &, size_t)
 
 _Concurrent_vector_base_v4 ()
 
_CONCRTIMP ~_Concurrent_vector_base_v4 ()
 
_CONCRTIMP void _Internal_reserve (_Size_type _N, _Size_type _Element_size, _Size_type _Max_size)
 
_CONCRTIMP _Size_type _Internal_capacity () const
 
void _Internal_grow (_Size_type _Start, _Size_type _Finish, _Size_type _Element_size, _My_internal_array_op2 _Init, const void *_Src)
 
_Size_type _Internal_grow_segment (const _Size_type _Start, _Size_type _Finish, _Size_type _Element_size, _Segment_t **_PPSegment, _Size_type *_PSegStart, _Size_type *_PSegFinish)
 
_CONCRTIMP _Size_type _Internal_grow_by (_Size_type _Delta, _Size_type _Element_size, _My_internal_array_op2 _Init, const void *_Src)
 
_CONCRTIMP void_Internal_push_back (_Size_type _Element_size, _Size_type &_Index)
 
_CONCRTIMP _Segment_index_t _Internal_clear (_My_internal_array_op1 _Destroy)
 
void _Internal_truncate (_Size_type _Old_size, _Size_type _New_size, _Size_type _Element_size, _My_internal_array_op1 _Destroy)
 
_CONCRTIMP void_Internal_compact (_Size_type _Element_size, void *_Table, _My_internal_array_op1 _Destroy, _My_internal_array_op2 _Copy)
 
_CONCRTIMP void _Internal_copy (const _Concurrent_vector_base_v4 &_Src, _Size_type _Element_size, _My_internal_array_op2 _Copy)
 
_CONCRTIMP void _Internal_assign (const _Concurrent_vector_base_v4 &_Src, _Size_type _Element_size, _My_internal_array_op1 _Destroy, _My_internal_array_op2 _Assign, _My_internal_array_op2 _Copy)
 
_CONCRTIMP void _Internal_throw_exception (_Size_type) const
 
_CONCRTIMP void _Internal_swap (_Concurrent_vector_base_v4 &)
 
_CONCRTIMP void _Internal_resize (_Size_type _New_size, _Size_type _Element_size, _Size_type _Max_size, _My_internal_array_op1 _Destroy, _My_internal_array_op2 _Init, const void *_Src)
 
_CONCRTIMP _Size_type _Internal_grow_to_at_least_with_result (_Size_type _New_size, _Size_type _Element_size, _My_internal_array_op2 _Init, const void *_Src)
 

Static Private Member Functions

static void *__cdecl _Internal_allocator (::Concurrency::details::_Concurrent_vector_base_v4 &_Vb, size_t _K)
 
static void __cdecl _Initialize_array (void *_Begin, const void *, size_type _N)
 
static void __cdecl _Initialize_array_by (void *_Begin, const void *_Src, size_type _N)
 
static void __cdecl _Copy_array (void *_Dst, const void *_Src, size_type _N)
 
static void __cdecl _Assign_array (void *_Dst, const void *_Src, size_type _N)
 
static void __cdecl _Destroy_array (void *_Begin, size_type _N)
 
- Static Private Member Functions inherited from Concurrency::details::_Concurrent_vector_base_v4
static _CONCRTIMP _Segment_index_t __cdecl _Segment_index_of (_Size_type _Index)
 
static _Segment_index_t _Segment_base (_Segment_index_t _K)
 
static _Segment_index_t _Segment_base_index_of (_Segment_index_t &_Index)
 
static _Size_type _Segment_size (_Segment_index_t _K)
 

Friends

template<typename _C , typename _U >
class details::_Vector_iterator
 

Additional Inherited Members

- Protected Types inherited from Concurrency::details::_Allocator_base< _Ty, _Ax >
typedef _Ax::template rebind< _Ty >::other _Allocator_type
 
- Protected Member Functions inherited from Concurrency::details::_Allocator_base< _Ty, _Ax >
 _Allocator_base ()
 
 _Allocator_base (const _Allocator_type &_Al)
 
- Protected Attributes inherited from Concurrency::details::_Allocator_base< _Ty, _Ax >
_Allocator_type _My_allocator
 
- Private Attributes inherited from Concurrency::details::_Concurrent_vector_base_v4
_Segment_t _My_storage [_Pointers_per_short_table]
 
_Subatomic< _Size_type_My_first_block
 
_Subatomic< _Size_type_My_early_size
 
_Subatomic< _Segment_t * > _My_segment
 
- Static Private Attributes inherited from Concurrency::details::_Concurrent_vector_base_v4
static const _Segment_index_t _Default_initial_segments = 1
 
static const _Segment_index_t _Pointers_per_short_table = 3
 
static const _Segment_index_t _Pointers_per_long_table = sizeof(_Segment_index_t) * 8
 

Detailed Description

template<typename _Ty, class _Ax>
class Concurrency::concurrent_vector< _Ty, _Ax >

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 Parameters
_TyThe data type of the elements to be stored in the vector.
_AxThe 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 >.

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

See also
Parallel Containers and Objects

Member Typedef Documentation

template<typename _Ty , class _Ax >
typedef concurrent_vector<_Ty, _Ax> Concurrency::concurrent_vector< _Ty, _Ax >::_Myt
private
template<typename _Ty , class _Ax >
typedef details::_Allocator_base<_Ty, _Ax>::_Allocator_type Concurrency::concurrent_vector< _Ty, _Ax >::allocator_type

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

template<typename _Ty , class _Ax >
typedef details::_Vector_iterator<concurrent_vector,const _Ty> Concurrency::concurrent_vector< _Ty, _Ax >::const_iterator

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

template<typename _Ty , class _Ax >
typedef const _Ty* Concurrency::concurrent_vector< _Ty, _Ax >::const_pointer

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

template<typename _Ty , class _Ax >
typedef const _Ty& Concurrency::concurrent_vector< _Ty, _Ax >::const_reference

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

template<typename _Ty , class _Ax >
typedef std::reverse_iterator<const_iterator> Concurrency::concurrent_vector< _Ty, _Ax >::const_reverse_iterator

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

template<typename _Ty , class _Ax >
typedef ptrdiff_t Concurrency::concurrent_vector< _Ty, _Ax >::difference_type

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

template<typename _Ty , class _Ax >
typedef details::_Vector_iterator<concurrent_vector,_Ty> Concurrency::concurrent_vector< _Ty, _Ax >::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.

template<typename _Ty , class _Ax >
typedef _Ty* Concurrency::concurrent_vector< _Ty, _Ax >::pointer

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

template<typename _Ty , class _Ax >
typedef _Ty& Concurrency::concurrent_vector< _Ty, _Ax >::reference

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

template<typename _Ty , class _Ax >
typedef std::reverse_iterator<iterator> Concurrency::concurrent_vector< _Ty, _Ax >::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.

template<typename _Ty , class _Ax >
typedef details::_Concurrent_vector_base_v4::_Size_type Concurrency::concurrent_vector< _Ty, _Ax >::size_type

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

template<typename _Ty , class _Ax >
typedef _Ty Concurrency::concurrent_vector< _Ty, _Ax >::value_type

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

Constructor & Destructor Documentation

template<typename _Ty , class _Ax >
Concurrency::concurrent_vector< _Ty, _Ax >::concurrent_vector ( const allocator_type _Al = allocator_type())
inlineexplicit

Constructs a concurrent vector.

Parameters
_AlThe allocator class to use with this object.

All constructors store an allocator object _Al and initialize the vector.

The first constructor specify an empty initial vector and explicitly specifies the allocator type. to be used.

The second and third constructors specify a copy of the concurrent vector _Vector .

The fourth constructor specifies a move of the concurrent vector _Vector .

The fifth constructor specifies a repetition of a specified number (_N ) of elements of the default value for class _Ty .

The sixth constructor specifies a repetition of (_N ) elements of value _Item .

The last constructor specifies values supplied by the iterator range [_Begin , _End ).

529  : details::_Allocator_base<_Ty, _Ax>(_Al)
530  {
532  }
void *__cdecl * _My_vector_allocator_ptr(_Concurrent_vector_base_v4 &, size_t)
static void *__cdecl _Internal_allocator(::Concurrency::details::_Concurrent_vector_base_v4 &_Vb, size_t _K)
Definition: concurrent_vector.h:1430
template<typename _Ty , class _Ax >
Concurrency::concurrent_vector< _Ty, _Ax >::concurrent_vector ( const concurrent_vector< _Ty, _Ax > &  _Vector)
inline

Constructs a concurrent vector.

Parameters
_VectorThe source concurrent_vector object to copy or move elements from.

All constructors store an allocator object _Al and initialize the vector.

The first constructor specify an empty initial vector and explicitly specifies the allocator type. to be used.

The second and third constructors specify a copy of the concurrent vector _Vector .

The fourth constructor specifies a move of the concurrent vector _Vector .

The fifth constructor specifies a repetition of a specified number (_N ) of elements of the default value for class _Ty .

The sixth constructor specifies a repetition of (_N ) elements of value _Item .

The last constructor specifies values supplied by the iterator range [_Begin , _End ).

553  : details::_Allocator_base<_Ty, _Ax>(_Vector.get_allocator())
554  {
556  _Internal_copy(_Vector, sizeof(_Ty), &_Copy_array);
557  }
void *__cdecl * _My_vector_allocator_ptr(_Concurrent_vector_base_v4 &, size_t)
_CONCRTIMP void _Internal_copy(const _Concurrent_vector_base_v4 &_Src, _Size_type _Element_size, _My_internal_array_op2 _Copy)
static void __cdecl _Copy_array(void *_Dst, const void *_Src, size_type _N)
Definition: concurrent_vector.h:1671
static void *__cdecl _Internal_allocator(::Concurrency::details::_Concurrent_vector_base_v4 &_Vb, size_t _K)
Definition: concurrent_vector.h:1430
template<typename _Ty , class _Ax >
template<class M >
Concurrency::concurrent_vector< _Ty, _Ax >::concurrent_vector ( const concurrent_vector< _Ty, M > &  _Vector,
const allocator_type _Al = allocator_type() 
)
inline

Constructs a concurrent vector.

Template Parameters
MThe allocator type of the source vector.
Parameters
_VectorThe source concurrent_vector object to copy or move elements from.
_AlThe allocator class to use with this object.

All constructors store an allocator object _Al and initialize the vector.

The first constructor specify an empty initial vector and explicitly specifies the allocator type. to be used.

The second and third constructors specify a copy of the concurrent vector _Vector .

The fourth constructor specifies a move of the concurrent vector _Vector .

The fifth constructor specifies a repetition of a specified number (_N ) of elements of the default value for class _Ty .

The sixth constructor specifies a repetition of (_N ) elements of value _Item .

The last constructor specifies values supplied by the iterator range [_Begin , _End ).

585  : details::_Allocator_base<_Ty, _Ax>(_Al)
586  {
588  _Internal_copy(_Vector._Internal_vector_base(), sizeof(_Ty), &_Copy_array);
589  }
void *__cdecl * _My_vector_allocator_ptr(_Concurrent_vector_base_v4 &, size_t)
_CONCRTIMP void _Internal_copy(const _Concurrent_vector_base_v4 &_Src, _Size_type _Element_size, _My_internal_array_op2 _Copy)
static void __cdecl _Copy_array(void *_Dst, const void *_Src, size_type _N)
Definition: concurrent_vector.h:1671
static void *__cdecl _Internal_allocator(::Concurrency::details::_Concurrent_vector_base_v4 &_Vb, size_t _K)
Definition: concurrent_vector.h:1430
template<typename _Ty , class _Ax >
Concurrency::concurrent_vector< _Ty, _Ax >::concurrent_vector ( concurrent_vector< _Ty, _Ax > &&  _Vector)
inline

Constructs a concurrent vector.

Parameters
_VectorThe source concurrent_vector object to copy or move elements from.

All constructors store an allocator object _Al and initialize the vector.

The first constructor specify an empty initial vector and explicitly specifies the allocator type. to be used.

The second and third constructors specify a copy of the concurrent vector _Vector .

The fourth constructor specifies a move of the concurrent vector _Vector .

The fifth constructor specifies a repetition of a specified number (_N ) of elements of the default value for class _Ty .

The sixth constructor specifies a repetition of (_N ) elements of value _Item .

The last constructor specifies values supplied by the iterator range [_Begin , _End ).

611  : details::_Allocator_base<_Ty, _Ax>(_Vector.get_allocator())
612  {
614  _Concurrent_vector_base_v4::_Internal_swap(_Vector._Internal_vector_base());
615  }
void *__cdecl * _My_vector_allocator_ptr(_Concurrent_vector_base_v4 &, size_t)
static void *__cdecl _Internal_allocator(::Concurrency::details::_Concurrent_vector_base_v4 &_Vb, size_t _K)
Definition: concurrent_vector.h:1430
template<typename _Ty , class _Ax >
Concurrency::concurrent_vector< _Ty, _Ax >::concurrent_vector ( size_type  _N)
inlineexplicit

Constructs a concurrent vector.

Parameters
_NThe initial size of the concurrent_vector object.

All constructors store an allocator object _Al and initialize the vector.

The first constructor specify an empty initial vector and explicitly specifies the allocator type. to be used.

The second and third constructors specify a copy of the concurrent vector _Vector .

The fourth constructor specifies a move of the concurrent vector _Vector .

The fifth constructor specifies a repetition of a specified number (_N ) of elements of the default value for class _Ty .

The sixth constructor specifies a repetition of (_N ) elements of value _Item .

The last constructor specifies values supplied by the iterator range [_Begin , _End ).

636  {
638  if ( !_N ) return;
639  _Internal_reserve(_N, sizeof(_Ty), max_size()); _My_early_size = _N;
641  _Initialize_array(static_cast<_Ty*>(_My_segment[0]._My_array), NULL, _N);
642  }
void *__cdecl * _My_vector_allocator_ptr(_Concurrent_vector_base_v4 &, size_t)
static _CONCRTIMP _Segment_index_t __cdecl _Segment_index_of(_Size_type _Index)
#define _CONCRT_ASSERT(x)
Definition: concrt.h:123
_In_ size_t _Deref_pre_opt_z_ char const _In_ size_t _N
Definition: wchar.h:78
static void __cdecl _Initialize_array(void *_Begin, const void *, size_type _N)
Definition: concurrent_vector.h:1659
size_type max_size() const
Returns the maximum number of elements the concurrent vector can hold. This method is concurrency-saf...
Definition: concurrent_vector.h:1097
_Subatomic< _Size_type > _My_early_size
Definition: concurrent_vector.h:160
static void *__cdecl _Internal_allocator(::Concurrency::details::_Concurrent_vector_base_v4 &_Vb, size_t _K)
Definition: concurrent_vector.h:1430
_Subatomic< _Size_type > _My_first_block
Definition: concurrent_vector.h:157
_CONCRTIMP void _Internal_reserve(_Size_type _N, _Size_type _Element_size, _Size_type _Max_size)
_Subatomic< _Segment_t * > _My_segment
Definition: concurrent_vector.h:163
#define NULL
Definition: corecrt.h:158
template<typename _Ty , class _Ax >
Concurrency::concurrent_vector< _Ty, _Ax >::concurrent_vector ( size_type  _N,
const_reference  _Item,
const allocator_type _Al = allocator_type() 
)
inline

Constructs a concurrent vector.

Parameters
_NThe initial capacity of the concurrent_vector object.
_ItemThe value of elements in the constructed object.
_AlThe allocator class to use with this object.

All constructors store an allocator object _Al and initialize the vector.

The first constructor specify an empty initial vector and explicitly specifies the allocator type. to be used.

The second and third constructors specify a copy of the concurrent vector _Vector .

The fourth constructor specifies a move of the concurrent vector _Vector .

The fifth constructor specifies a repetition of a specified number (_N ) of elements of the default value for class _Ty .

The sixth constructor specifies a repetition of (_N ) elements of value _Item .

The last constructor specifies values supplied by the iterator range [_Begin , _End ).

669  : details::_Allocator_base<_Ty, _Ax>(_Al)
670  {
672  _Internal_assign( _N, _Item );
673  }
void *__cdecl * _My_vector_allocator_ptr(_Concurrent_vector_base_v4 &, size_t)
_In_ size_t _Deref_pre_opt_z_ char const _In_ size_t _N
Definition: wchar.h:78
static void *__cdecl _Internal_allocator(::Concurrency::details::_Concurrent_vector_base_v4 &_Vb, size_t _K)
Definition: concurrent_vector.h:1430
void _Internal_assign(size_type _N, const_reference _Item)
Definition: concurrent_vector.h:1604
template<typename _Ty , class _Ax >
template<class _InputIterator >
Concurrency::concurrent_vector< _Ty, _Ax >::concurrent_vector ( _InputIterator  _Begin,
_InputIterator  _End,
const allocator_type _Al = allocator_type() 
)
inline

Constructs a concurrent vector.

Template Parameters
_InputIteratorThe type of the input iterator.
Parameters
_BeginPosition of the first element in the range of elements to be copied.
_EndPosition of the first element beyond the range of elements to be copied.
_AlThe allocator class to use with this object.

All constructors store an allocator object _Al and initialize the vector.

The first constructor specify an empty initial vector and explicitly specifies the allocator type. to be used.

The second and third constructors specify a copy of the concurrent vector _Vector .

The fourth constructor specifies a move of the concurrent vector _Vector .

The fifth constructor specifies a repetition of a specified number (_N ) of elements of the default value for class _Ty .

The sixth constructor specifies a repetition of (_N ) elements of value _Item .

The last constructor specifies values supplied by the iterator range [_Begin , _End ).

704  : details::_Allocator_base<_Ty, _Ax>(_Al)
705  {
707  _Internal_assign(_Begin, _End, static_cast<_Is_integer_tag<std::numeric_limits<_InputIterator>::is_integer> *>(0) );
708  }
void *__cdecl * _My_vector_allocator_ptr(_Concurrent_vector_base_v4 &, size_t)
static void *__cdecl _Internal_allocator(::Concurrency::details::_Concurrent_vector_base_v4 &_Vb, size_t _K)
Definition: concurrent_vector.h:1430
void _Internal_assign(size_type _N, const_reference _Item)
Definition: concurrent_vector.h:1604
template<typename _Ty , class _Ax >
Concurrency::concurrent_vector< _Ty, _Ax >::~concurrent_vector ( )
inline

Erases all elements and destroys this concurrent vector.

1419  {
1420  _Segment_t *_Table = _My_segment;
1421  _Internal_free_segments( reinterpret_cast<void**>(_Table), _Internal_clear(&_Destroy_array), _My_first_block );
1422  // base class destructor call
1423  }
_CONCRTIMP _Segment_index_t _Internal_clear(_My_internal_array_op1 _Destroy)
_Subatomic< _Size_type > _My_first_block
Definition: concurrent_vector.h:157
void _Internal_free_segments(void *_Table[], _Segment_index_t _K, _Segment_index_t _First_block)
Definition: concurrent_vector.h:1553
_Subatomic< _Segment_t * > _My_segment
Definition: concurrent_vector.h:163
static void __cdecl _Destroy_array(void *_Begin, size_type _N)
Definition: concurrent_vector.h:1685

Member Function Documentation

template<typename _Ty , class _Ax >
void __cdecl Concurrency::concurrent_vector< _Ty, _Ax >::_Assign_array ( void _Dst,
const void _Src,
size_type  _N 
)
staticprivate
1677 {
1678  _Internal_loop_guide _Loop(_N, _Dst); _Loop._Assign(_Src);
1679 }
_In_ size_t _Deref_pre_opt_z_ char const _In_ size_t _N
Definition: wchar.h:78
_In_ size_t _Out_opt_ int _In_z_ unsigned char const * _Src
Definition: mbstring.h:1039
template<typename _Ty , class _Ax >
void __cdecl Concurrency::concurrent_vector< _Ty, _Ax >::_Copy_array ( void _Dst,
const void _Src,
size_type  _N 
)
staticprivate
1671  {
1672  _Internal_loop_guide _Loop(_N, _Dst); _Loop._Copy(_Src);
1673 }
_In_ size_t _Deref_pre_opt_z_ char const _In_ size_t _N
Definition: wchar.h:78
_In_ size_t _Out_opt_ int _In_z_ unsigned char const * _Src
Definition: mbstring.h:1039
template<typename _Ty , class _Ax >
void __cdecl Concurrency::concurrent_vector< _Ty, _Ax >::_Destroy_array ( void _Begin,
size_type  _N 
)
staticprivate
1686 {
1687  _Ty* _Array = static_cast<_Ty*>(_Begin);
1688  for( size_type _J=_N; _J>0; --_J )
1689  _Array[_J-1].~_Ty(); // destructors are supposed to not throw any exceptions
1690 }
_In_ size_t _Deref_pre_opt_z_ char const _In_ size_t _N
Definition: wchar.h:78
details::_Concurrent_vector_base_v4::_Size_type size_type
A type that counts the number of elements in a concurrent vector.
Definition: concurrent_vector.h:439
template<typename _Ty , class _Ax >
void __cdecl Concurrency::concurrent_vector< _Ty, _Ax >::_Initialize_array ( void _Begin,
const void ,
size_type  _N 
)
staticprivate
1660 {
1661  _Internal_loop_guide _Loop(_N, _Begin); _Loop._Init();
1662 }
_In_ size_t _Deref_pre_opt_z_ char const _In_ size_t _N
Definition: wchar.h:78
template<typename _Ty , class _Ax >
void __cdecl Concurrency::concurrent_vector< _Ty, _Ax >::_Initialize_array_by ( void _Begin,
const void _Src,
size_type  _N 
)
staticprivate
1666 {
1667  _Internal_loop_guide _Loop(_N, _Begin); _Loop._Init(_Src);
1668 }
_In_ size_t _Deref_pre_opt_z_ char const _In_ size_t _N
Definition: wchar.h:78
_In_ size_t _Out_opt_ int _In_z_ unsigned char const * _Src
Definition: mbstring.h:1039
template<typename _Ty , class _Ax >
static void* __cdecl Concurrency::concurrent_vector< _Ty, _Ax >::_Internal_allocator ( ::Concurrency::details::_Concurrent_vector_base_v4 _Vb,
size_t  _K 
)
inlinestaticprivate
1431  {
1432  return static_cast<concurrent_vector<_Ty, _Ax>&>(_Vb)._My_allocator.allocate(_K);
1433  }
_Allocator_type _My_allocator
Definition: concurrent_vector.h:391
template<typename _Ty , class _Ax >
void Concurrency::concurrent_vector< _Ty, _Ax >::_Internal_assign ( size_type  _N,
const_reference  _Item 
)
private
1605 {
1607  if( !_N )
1608  return;
1609  _Internal_reserve(_N, sizeof(_Ty), max_size());
1610  _My_early_size = _N;
1611  _Segment_index_t _K = 0;
1613  while (_Sz < _N)
1614  {
1615  _Initialize_array_by(static_cast<_Ty*>(_My_segment[_K]._My_array), static_cast<const void*>(&_Item), _Sz);
1616  _N -= _Sz;
1617  if (!_K)
1618  {
1619  _K = _My_first_block;
1620  }
1621  else {
1622  ++_K;
1623  _Sz <<= 1;
1624  }
1625  }
1626  _Initialize_array_by(static_cast<_Ty*>(_My_segment[_K]._My_array), static_cast<const void*>(&_Item), _N);
1627 }
size_t _Size_type
Definition: concurrent_vector.h:71
#define _CONCRT_ASSERT(x)
Definition: concrt.h:123
_In_ size_t _Deref_pre_opt_z_ char const _In_ size_t _N
Definition: wchar.h:78
static _Size_type _Segment_size(_Segment_index_t _K)
Definition: concurrent_vector.h:120
static void __cdecl _Initialize_array_by(void *_Begin, const void *_Src, size_type _N)
Definition: concurrent_vector.h:1665
size_type max_size() const
Returns the maximum number of elements the concurrent vector can hold. This method is concurrency-saf...
Definition: concurrent_vector.h:1097
size_t _Segment_index_t
Definition: concurrent_vector.h:70
_Subatomic< _Size_type > _My_early_size
Definition: concurrent_vector.h:160
_Subatomic< _Size_type > _My_first_block
Definition: concurrent_vector.h:157
_CONCRTIMP void _Internal_reserve(_Size_type _N, _Size_type _Element_size, _Size_type _Max_size)
_Subatomic< _Segment_t * > _My_segment
Definition: concurrent_vector.h:163
template<typename _Ty , class _Ax >
template<class _I >
void Concurrency::concurrent_vector< _Ty, _Ax >::_Internal_assign ( _I  _First,
_I  _Last,
_Is_integer_tag< true > *   
)
inlineprivate
1452  {
1453  _Internal_assign(static_cast<size_type>(_First), static_cast<_Ty>(_Last));
1454  }
_FwdIt _Last
Definition: algorithm:1936
void _Internal_assign(size_type _N, const_reference _Item)
Definition: concurrent_vector.h:1604
template<typename _Ty , class _Ax >
template<class _I >
void Concurrency::concurrent_vector< _Ty, _Ax >::_Internal_assign ( _I  _First,
_I  _Last,
_Is_integer_tag< false > *   
)
inlineprivate
1457  {
1459  }
void internal_assign_iterators(_I _First, _I _Last)
Definition: concurrent_vector.h:1630
_FwdIt _Last
Definition: algorithm:1936
template<typename _Ty , class _Ax >
void Concurrency::concurrent_vector< _Ty, _Ax >::_Internal_free_segments ( void _Table[],
_Segment_index_t  _K,
_Segment_index_t  _First_block 
)
private
1554 {
1555  // Free the arrays
1556  while( _K > _First_block )
1557  {
1558  --_K;
1559  _Ty* _Array = static_cast<_Ty*>(_Table[_K]);
1560  _Table[_K] = NULL;
1561  if( _Array > _BAD_ALLOC_MARKER ) // check for correct segment pointer
1562  this->_My_allocator.deallocate( _Array, _Segment_size(_K) );
1563  }
1564  _Ty* _Array = static_cast<_Ty*>(_Table[0]);
1565  if( _Array > _BAD_ALLOC_MARKER )
1566  {
1567  _CONCRT_ASSERT( _First_block > 0 );
1568  while(_K > 0)
1569  _Table[--_K] = NULL;
1570  this->_My_allocator.deallocate( _Array, _Segment_size(_First_block) );
1571  }
1572 }
#define _CONCRT_ASSERT(x)
Definition: concrt.h:123
static _Size_type _Segment_size(_Segment_index_t _K)
Definition: concurrent_vector.h:120
#define _BAD_ALLOC_MARKER
Definition: concurrent_vector.h:62
#define NULL
Definition: corecrt.h:158
_Allocator_type _My_allocator
Definition: concurrent_vector.h:391
template<typename _Ty , class _Ax >
_Ty & Concurrency::concurrent_vector< _Ty, _Ax >::_Internal_subscript ( size_type  _Index) const
private
1576 {
1577  _CONCRT_ASSERT( _Index<_My_early_size ); // index out of bounds
1578  size_type _J = _Index;
1580  _CONCRT_ASSERT( _My_segment != (_Segment_t*)_My_storage || _K < _Pointers_per_short_table ); // index is under construction
1581  // no need in load_with_acquire because the thread works in its own space or gets
1582  _Ty* _Array = static_cast<_Ty*>(_My_segment[_K]._My_array);
1583  _CONCRT_ASSERT( _Array != _BAD_ALLOC_MARKER ); // instance may be broken by bad allocation; use at() instead
1584  _CONCRT_ASSERT( _Array != NULL ); // index is being allocated
1585  return _Array[_J];
1586 }
#define _CONCRT_ASSERT(x)
Definition: concrt.h:123
static _Segment_index_t _Segment_base_index_of(_Segment_index_t &_Index)
Definition: concurrent_vector.h:113
_In_ size_t _In_ int _Index
Definition: time.h:102
size_t _Segment_index_t
Definition: concurrent_vector.h:70
_Subatomic< _Size_type > _My_early_size
Definition: concurrent_vector.h:160
static const _Segment_index_t _Pointers_per_short_table
Definition: concurrent_vector.h:77
_Segment_t _My_storage[_Pointers_per_short_table]
Definition: concurrent_vector.h:92
#define _BAD_ALLOC_MARKER
Definition: concurrent_vector.h:62
details::_Concurrent_vector_base_v4::_Size_type size_type
A type that counts the number of elements in a concurrent vector.
Definition: concurrent_vector.h:439
_Subatomic< _Segment_t * > _My_segment
Definition: concurrent_vector.h:163
#define NULL
Definition: corecrt.h:158
template<typename _Ty , class _Ax >
_Ty & Concurrency::concurrent_vector< _Ty, _Ax >::_Internal_subscript_with_exceptions ( size_type  _Index) const
private
1590 {
1591  if( _Index >= _My_early_size )
1592  _Internal_throw_exception(0); // throw std::out_of_range
1593  size_type _J = _Index;
1595  if( _My_segment == (_Segment_t*)_My_storage && _K >= _Pointers_per_short_table )
1596  _Internal_throw_exception(1); // throw std::out_of_range
1597  void *_Array = _My_segment[_K]._My_array; // no need in load_with_acquire
1598  if( _Array <= _BAD_ALLOC_MARKER ) // check for correct segment pointer
1599  _Internal_throw_exception(2); // throw std::range_error
1600  return static_cast<_Ty*>(_Array)[_J];
1601 }
_CONCRTIMP void _Internal_throw_exception(_Size_type) const
static _Segment_index_t _Segment_base_index_of(_Segment_index_t &_Index)
Definition: concurrent_vector.h:113
_In_ size_t _In_ int _Index
Definition: time.h:102
size_t _Segment_index_t
Definition: concurrent_vector.h:70
_Subatomic< _Size_type > _My_early_size
Definition: concurrent_vector.h:160
static const _Segment_index_t _Pointers_per_short_table
Definition: concurrent_vector.h:77
_Segment_t _My_storage[_Pointers_per_short_table]
Definition: concurrent_vector.h:92
#define _BAD_ALLOC_MARKER
Definition: concurrent_vector.h:62
details::_Concurrent_vector_base_v4::_Size_type size_type
A type that counts the number of elements in a concurrent vector.
Definition: concurrent_vector.h:439
_Subatomic< _Segment_t * > _My_segment
Definition: concurrent_vector.h:163
template<typename _Ty , class _Ax >
const ::Concurrency::details::_Concurrent_vector_base_v4& Concurrency::concurrent_vector< _Ty, _Ax >::_Internal_vector_base ( ) const
inline
1425 { return *this; }
template<typename _Ty , class _Ax >
::Concurrency::details::_Concurrent_vector_base_v4& Concurrency::concurrent_vector< _Ty, _Ax >::_Internal_vector_base ( )
inline
1426 { return *this; }
template<typename _Ty , class _Ax >
void Concurrency::concurrent_vector< _Ty, _Ax >::assign ( size_type  _N,
const_reference  _Item 
)
inline

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.

Parameters
_NThe number of items to copy into the concurrent vector.
_ItemReference to a value used to fill the concurrent vector.

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

1353  {
1354  clear();
1355  _Internal_assign( _N, _Item );
1356  }
_In_ size_t _Deref_pre_opt_z_ char const _In_ size_t _N
Definition: wchar.h:78
void clear()
Erases all elements in the concurrent vector. This method is not concurrency-safe.
Definition: concurrent_vector.h:1409
void _Internal_assign(size_type _N, const_reference _Item)
Definition: concurrent_vector.h:1604
template<typename _Ty , class _Ax >
template<class _InputIterator >
void Concurrency::concurrent_vector< _Ty, _Ax >::assign ( _InputIterator  _Begin,
_InputIterator  _End 
)
inline

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.

Template Parameters
_InputIteratorThe type of the specified iterator.
Parameters
_BeginAn iterator to the first element of the source range.
_EndAn iterator to one past the last element of the source range.

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

1379  {
1380  clear();
1381  _Internal_assign( _Begin, _End, static_cast<_Is_integer_tag<std::numeric_limits<_InputIterator>::is_integer> *>(0) );
1382  }
void clear()
Erases all elements in the concurrent vector. This method is not concurrency-safe.
Definition: concurrent_vector.h:1409
void _Internal_assign(size_type _N, const_reference _Item)
Definition: concurrent_vector.h:1604
template<typename _Ty , class _Ax >
reference Concurrency::concurrent_vector< _Ty, _Ax >::at ( size_type  _Index)
inline

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.

Parameters
_IndexThe index of the element to be retrieved.
Returns
A reference to the item at the given index.

The version of the function at that returns a non-const reference 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.

The method throws out_of_range if _Index is greater than or equal to the size of the concurrent vector, and range_error if the index is for a broken portion of the vector. For details on how a vector can become broken, see Parallel Containers and Objects.

937  {
939  }
_In_ size_t _In_ int _Index
Definition: time.h:102
_Ty & _Internal_subscript_with_exceptions(size_type _Index) const
Definition: concurrent_vector.h:1589
template<typename _Ty , class _Ax >
const_reference Concurrency::concurrent_vector< _Ty, _Ax >::at ( size_type  _Index) const
inline

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.

Parameters
_IndexThe index of the element to be retrieved.
Returns
A const reference to the item at the given index.

The version of the function at that returns a non-const reference 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.

The method throws out_of_range if _Index is greater than or equal to the size of the concurrent vector, and range_error if the index is for a broken portion of the vector. For details on how a vector can become broken, see Parallel Containers and Objects.

962  {
964  }
_In_ size_t _In_ int _Index
Definition: time.h:102
_Ty & _Internal_subscript_with_exceptions(size_type _Index) const
Definition: concurrent_vector.h:1589
template<typename _Ty , class _Ax >
reference Concurrency::concurrent_vector< _Ty, _Ax >::back ( )
inline

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.

Returns
A reference or a const reference to the last element in the concurrent vector.
1303  {
1304  _Size_type sz = size();
1305  _CONCRT_ASSERT( sz > 0 );
1306  return _Internal_subscript( sz-1 );
1307  }
size_t _Size_type
Definition: concurrent_vector.h:71
#define _CONCRT_ASSERT(x)
Definition: concrt.h:123
_Ty & _Internal_subscript(size_type _Index) const
Definition: concurrent_vector.h:1575
size_type size() const
Returns the number of elements in the concurrent vector. This method is concurrency-safe.
Definition: concurrent_vector.h:978
template<typename _Ty , class _Ax >
const_reference Concurrency::concurrent_vector< _Ty, _Ax >::back ( ) const
inline

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.

Returns
A reference or a const reference to the last element in the concurrent vector.
1318  {
1319  _Size_type sz = size();
1320  _CONCRT_ASSERT( sz > 0 );
1321  return _Internal_subscript( sz-1 );
1322  }
size_t _Size_type
Definition: concurrent_vector.h:71
#define _CONCRT_ASSERT(x)
Definition: concrt.h:123
_Ty & _Internal_subscript(size_type _Index) const
Definition: concurrent_vector.h:1575
size_type size() const
Returns the number of elements in the concurrent vector. This method is concurrency-safe.
Definition: concurrent_vector.h:978
template<typename _Ty , class _Ax >
iterator Concurrency::concurrent_vector< _Ty, _Ax >::begin ( )
inline

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

Returns
An iterator of type iterator or const_iterator to the beginning of the concurrent vector.
1112  {
1113  return iterator(*this,0);
1114  }
details::_Vector_iterator< concurrent_vector, _Ty > iterator
A type that provides a random-access iterator that can read any element in a concurrent vector...
Definition: concurrent_vector.h:489
template<typename _Ty , class _Ax >
const_iterator Concurrency::concurrent_vector< _Ty, _Ax >::begin ( ) const
inline

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

Returns
An iterator of type iterator or const_iterator to the beginning of the concurrent vector.
1140  {
1141  return const_iterator(*this,0);
1142  }
details::_Vector_iterator< concurrent_vector, const _Ty > const_iterator
A type that provides a random-access iterator that can read a const element in a concurrent vector...
Definition: concurrent_vector.h:495
template<typename _Ty , class _Ax >
size_type Concurrency::concurrent_vector< _Ty, _Ax >::capacity ( ) const
inline

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

Returns
The maximum size to which the concurrent vector can grow without having to allocate more memory.

Unlike an STL vector, a concurrent_vector object does not move existing elements if it allocates more memory.

1009  {
1010  return _Internal_capacity();
1011  }
_CONCRTIMP _Size_type _Internal_capacity() const
template<typename _Ty , class _Ax >
const_iterator Concurrency::concurrent_vector< _Ty, _Ax >::cbegin ( ) const
inline

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

Returns
An iterator of type const_iterator to the beginning of the concurrent vector.
1223  {
1224  return (((const _Myt *)this)->begin());
1225  }
concurrent_vector< _Ty, _Ax > _Myt
Definition: concurrent_vector.h:428
iterator begin()
Returns an iterator of type iterator or const_iterator to the beginning of the concurrent vector...
Definition: concurrent_vector.h:1111
template<typename _Ty , class _Ax >
const_iterator Concurrency::concurrent_vector< _Ty, _Ax >::cend ( ) const
inline

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

Returns
An iterator of type const_iterator to the end of the concurrent vector.
1236  {
1237  return (((const _Myt *)this)->end());
1238  }
concurrent_vector< _Ty, _Ax > _Myt
Definition: concurrent_vector.h:428
iterator end()
Returns an iterator of type iterator or const_iterator to the end of the concurrent vector...
Definition: concurrent_vector.h:1125
template<typename _Ty , class _Ax >
void Concurrency::concurrent_vector< _Ty, _Ax >::clear ( )
inline

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

clear is not concurrency-safe. You must ensure that no other threads are invoking methods on the concurrent vector when you call this method. clear does not free internal arrays. To free internal arrays, call the function shrink_to_fit after clear.

1410  {
1412  }
_CONCRTIMP _Segment_index_t _Internal_clear(_My_internal_array_op1 _Destroy)
static void __cdecl _Destroy_array(void *_Begin, size_type _N)
Definition: concurrent_vector.h:1685
template<typename _Ty , class _Ax >
const_reverse_iterator Concurrency::concurrent_vector< _Ty, _Ax >::crbegin ( ) const
inline

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

Returns
An iterator of type const_reverse_iterator to the beginning of the concurrent vector.
1249  {
1250  return (((const _Myt *)this)->rbegin());
1251  }
reverse_iterator rbegin()
Returns an iterator of type reverse_iterator or const_reverse_iterator to the beginning of the conc...
Definition: concurrent_vector.h:1167
concurrent_vector< _Ty, _Ax > _Myt
Definition: concurrent_vector.h:428
template<typename _Ty , class _Ax >
const_reverse_iterator Concurrency::concurrent_vector< _Ty, _Ax >::crend ( ) const
inline

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

Returns
An iterator of type const_reverse_iterator to the end of the concurrent vector.
1262  {
1263  return (((const _Myt *)this)->rend());
1264  }
reverse_iterator rend()
Returns an iterator of type reverse_iterator or const_reverse_iterator to the end of the concurrent...
Definition: concurrent_vector.h:1181
concurrent_vector< _Ty, _Ax > _Myt
Definition: concurrent_vector.h:428
template<typename _Ty , class _Ax >
bool Concurrency::concurrent_vector< _Ty, _Ax >::empty ( ) const
inline

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

Returns
true if the vector was empty at the moment the function was called, false otherwise.
993  {
994  return !_My_early_size;
995  }
_Subatomic< _Size_type > _My_early_size
Definition: concurrent_vector.h:160
template<typename _Ty , class _Ax >
iterator Concurrency::concurrent_vector< _Ty, _Ax >::end ( )
inline

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

Returns
An iterator of type iterator or const_iterator to the end of the concurrent vector.
1126  {
1127  return iterator(*this,size());
1128  }
details::_Vector_iterator< concurrent_vector, _Ty > iterator
A type that provides a random-access iterator that can read any element in a concurrent vector...
Definition: concurrent_vector.h:489
size_type size() const
Returns the number of elements in the concurrent vector. This method is concurrency-safe.
Definition: concurrent_vector.h:978
template<typename _Ty , class _Ax >
const_iterator Concurrency::concurrent_vector< _Ty, _Ax >::end ( ) const
inline

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

Returns
An iterator of type iterator or const_iterator to the end of the concurrent vector.
1154  {
1155  return const_iterator(*this,size());
1156  }
details::_Vector_iterator< concurrent_vector, const _Ty > const_iterator
A type that provides a random-access iterator that can read a const element in a concurrent vector...
Definition: concurrent_vector.h:495
size_type size() const
Returns the number of elements in the concurrent vector. This method is concurrency-safe.
Definition: concurrent_vector.h:978
template<typename _Ty , class _Ax >
reference Concurrency::concurrent_vector< _Ty, _Ax >::front ( )
inline

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.

Returns
A reference or a const reference to the first element in the concurrent vector.
1275  {
1276  _CONCRT_ASSERT( size()>0 );
1277  return static_cast<_Ty*>(_My_segment[0]._My_array)[0];
1278  }
#define _CONCRT_ASSERT(x)
Definition: concrt.h:123
_Subatomic< _Segment_t * > _My_segment
Definition: concurrent_vector.h:163
size_type size() const
Returns the number of elements in the concurrent vector. This method is concurrency-safe.
Definition: concurrent_vector.h:978
template<typename _Ty , class _Ax >
const_reference Concurrency::concurrent_vector< _Ty, _Ax >::front ( ) const
inline

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.

Returns
A reference or a const reference to the first element in the concurrent_vector object.
1289  {
1290  _CONCRT_ASSERT( size()>0 );
1291  return static_cast<_Ty*>(_My_segment[0]._My_array)[0];
1292  }
#define _CONCRT_ASSERT(x)
Definition: concrt.h:123
_Subatomic< _Segment_t * > _My_segment
Definition: concurrent_vector.h:163
size_type size() const
Returns the number of elements in the concurrent vector. This method is concurrency-safe.
Definition: concurrent_vector.h:978
template<typename _Ty , class _Ax >
allocator_type Concurrency::concurrent_vector< _Ty, _Ax >::get_allocator ( ) const
inline

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

Returns
A copy of the allocator used to construct the concurrent_vector object.
1332  {
1333  return this->_My_allocator;
1334  }
_Allocator_type _My_allocator
Definition: concurrent_vector.h:391
template<typename _Ty , class _Ax >
iterator Concurrency::concurrent_vector< _Ty, _Ax >::grow_by ( size_type  _Delta)
inline

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

Parameters
_DeltaThe number of elements to append to the object.
Returns
An iterator to first item appended.

If _Item is not specified, the new elements are default constructed.

785  {
786  return iterator(*this, _Delta ? _Internal_grow_by( _Delta, sizeof(_Ty), &_Initialize_array, NULL ) : _My_early_size);
787  }
_CONCRTIMP _Size_type _Internal_grow_by(_Size_type _Delta, _Size_type _Element_size, _My_internal_array_op2 _Init, const void *_Src)
details::_Vector_iterator< concurrent_vector, _Ty > iterator
A type that provides a random-access iterator that can read any element in a concurrent vector...
Definition: concurrent_vector.h:489
static void __cdecl _Initialize_array(void *_Begin, const void *, size_type _N)
Definition: concurrent_vector.h:1659
_Subatomic< _Size_type > _My_early_size
Definition: concurrent_vector.h:160
#define NULL
Definition: corecrt.h:158
template<typename _Ty , class _Ax >
iterator Concurrency::concurrent_vector< _Ty, _Ax >::grow_by ( size_type  _Delta,
const_reference  _Item 
)
inline

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

Parameters
_DeltaThe number of elements to append to the object.
_ItemThe value to initialize the new elements with.
Returns
An iterator to first item appended.

If _Item is not specified, the new elements are default constructed.

806  {
807  return iterator(*this, _Delta ? _Internal_grow_by( _Delta, sizeof(_Ty), &_Initialize_array_by, static_cast<const void*>(&_Item) ) : _My_early_size);
808  }
_CONCRTIMP _Size_type _Internal_grow_by(_Size_type _Delta, _Size_type _Element_size, _My_internal_array_op2 _Init, const void *_Src)
details::_Vector_iterator< concurrent_vector, _Ty > iterator
A type that provides a random-access iterator that can read any element in a concurrent vector...
Definition: concurrent_vector.h:489
static void __cdecl _Initialize_array_by(void *_Begin, const void *_Src, size_type _N)
Definition: concurrent_vector.h:1665
_Subatomic< _Size_type > _My_early_size
Definition: concurrent_vector.h:160
template<typename _Ty , class _Ax >
iterator Concurrency::concurrent_vector< _Ty, _Ax >::grow_to_at_least ( size_type  _N)
inline

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

Parameters
_NThe new minimum size for the concurrent_vector object.
Returns
An iterator that points to beginning of appended sequence, or to the element at index _N if no elements were appended.
822  {
823  size_type _M = 0;
824  if( _N )
825  {
827  if( _M > _N )
828  _M = _N;
829  }
830  return iterator(*this, _M);
831  };
_CONCRTIMP _Size_type _Internal_grow_to_at_least_with_result(_Size_type _New_size, _Size_type _Element_size, _My_internal_array_op2 _Init, const void *_Src)
_In_ size_t _Deref_pre_opt_z_ char const _In_ size_t _N
Definition: wchar.h:78
details::_Vector_iterator< concurrent_vector, _Ty > iterator
A type that provides a random-access iterator that can read any element in a concurrent vector...
Definition: concurrent_vector.h:489
static void __cdecl _Initialize_array(void *_Begin, const void *, size_type _N)
Definition: concurrent_vector.h:1659
details::_Concurrent_vector_base_v4::_Size_type size_type
A type that counts the number of elements in a concurrent vector.
Definition: concurrent_vector.h:439
#define NULL
Definition: corecrt.h:158
template<typename _Ty , class _Ax >
template<class _I >
void Concurrency::concurrent_vector< _Ty, _Ax >::internal_assign_iterators ( _I  _First,
_I  _Last 
)
private
1631 {
1633  size_type _N = std::distance(_First, _Last);
1634  if( !_N ) return;
1635  _Internal_reserve(_N, sizeof(_Ty), max_size());
1636  _My_early_size = _N;
1637  _Segment_index_t _K = 0;
1639  while (_Sz < _N)
1640  {
1641  _Internal_loop_guide _Loop(_Sz, _My_segment[_K]._My_array);
1642  _Loop._Iterate(_First);
1643  _N -= _Sz;
1644  if (!_K)
1645  {
1646  _K = _My_first_block;
1647  }
1648  else {
1649  ++_K;
1650  _Sz <<= 1;
1651  }
1652  }
1653 
1654  _Internal_loop_guide _Loop(_N, _My_segment[_K]._My_array);
1655  _Loop._Iterate(_First);
1656 }
size_t _Size_type
Definition: concurrent_vector.h:71
#define _CONCRT_ASSERT(x)
Definition: concrt.h:123
_In_ size_t _Deref_pre_opt_z_ char const _In_ size_t _N
Definition: wchar.h:78
static _Size_type _Segment_size(_Segment_index_t _K)
Definition: concurrent_vector.h:120
_Iter_diff_t< _InIt > distance(_InIt _First, _InIt _Last)
Definition: xutility:1111
size_type max_size() const
Returns the maximum number of elements the concurrent vector can hold. This method is concurrency-saf...
Definition: concurrent_vector.h:1097
size_t _Segment_index_t
Definition: concurrent_vector.h:70
_Subatomic< _Size_type > _My_early_size
Definition: concurrent_vector.h:160
_Subatomic< _Size_type > _My_first_block
Definition: concurrent_vector.h:157
details::_Concurrent_vector_base_v4::_Size_type size_type
A type that counts the number of elements in a concurrent vector.
Definition: concurrent_vector.h:439
_CONCRTIMP void _Internal_reserve(_Size_type _N, _Size_type _Element_size, _Size_type _Max_size)
_Subatomic< _Segment_t * > _My_segment
Definition: concurrent_vector.h:163
_FwdIt _Last
Definition: algorithm:1936
template<typename _Ty , class _Ax >
size_type Concurrency::concurrent_vector< _Ty, _Ax >::max_size ( ) const
inline

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

Returns
The maximum number of elements the concurrent_vector object can hold.
1098  {
1099  return (~size_type(0))/sizeof(_Ty);
1100  }
details::_Concurrent_vector_base_v4::_Size_type size_type
A type that counts the number of elements in a concurrent vector.
Definition: concurrent_vector.h:439
template<typename _Ty , class _Ax >
concurrent_vector& Concurrency::concurrent_vector< _Ty, _Ax >::operator= ( const concurrent_vector< _Ty, _Ax > &  _Vector)
inline

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

Parameters
_VectorThe source concurrent_vector object.
Returns
A reference to this concurrent_vector object.
721  {
722  if( this != &_Vector )
723  _Concurrent_vector_base_v4::_Internal_assign(_Vector, sizeof(_Ty), &_Destroy_array, &_Assign_array, &_Copy_array);
724  return *this;
725  }
static void __cdecl _Assign_array(void *_Dst, const void *_Src, size_type _N)
Definition: concurrent_vector.h:1676
static void __cdecl _Copy_array(void *_Dst, const void *_Src, size_type _N)
Definition: concurrent_vector.h:1671
static void __cdecl _Destroy_array(void *_Begin, size_type _N)
Definition: concurrent_vector.h:1685
template<typename _Ty , class _Ax >
template<class M >
concurrent_vector& Concurrency::concurrent_vector< _Ty, _Ax >::operator= ( const concurrent_vector< _Ty, M > &  _Vector)
inline

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

Template Parameters
MThe allocator type of the source vector.
Parameters
_VectorThe source concurrent_vector object.
Returns
A reference to this concurrent_vector object.
742  {
743  if( static_cast<void*>( this ) != static_cast<const void*>( &_Vector ) )
744  {
745  _Concurrent_vector_base_v4::_Internal_assign(_Vector._Internal_vector_base(),
746  sizeof(_Ty), &_Destroy_array, &_Assign_array, &_Copy_array);
747  }
748  return *this;
749  }
static void __cdecl _Assign_array(void *_Dst, const void *_Src, size_type _N)
Definition: concurrent_vector.h:1676
static void __cdecl _Copy_array(void *_Dst, const void *_Src, size_type _N)
Definition: concurrent_vector.h:1671
static void __cdecl _Destroy_array(void *_Begin, size_type _N)
Definition: concurrent_vector.h:1685
template<typename _Ty , class _Ax >
concurrent_vector& Concurrency::concurrent_vector< _Ty, _Ax >::operator= ( concurrent_vector< _Ty, _Ax > &&  _Vector)
inline

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

Parameters
_VectorThe source concurrent_vector object.
Returns
A reference to this concurrent_vector object.
762  {
763  if( static_cast<void*>( this ) != static_cast<const void*>( &_Vector ) )
764  {
765  _Concurrent_vector_base_v4::_Internal_swap(_Vector._Internal_vector_base());
766  _Vector.clear();
767  }
768  return *this;
769  }
template<typename _Ty , class _Ax >
reference Concurrency::concurrent_vector< _Ty, _Ax >::operator[] ( size_type  _Index)
inline

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.

Parameters
_IndexThe index of the element to be retrieved.
Returns
A reference to the item at the given index.

The version of operator [] that returns a non-const reference 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.

889  {
890  return _Internal_subscript(_Index);
891  }
_In_ size_t _In_ int _Index
Definition: time.h:102
_Ty & _Internal_subscript(size_type _Index) const
Definition: concurrent_vector.h:1575
template<typename _Ty , class _Ax >
const_reference Concurrency::concurrent_vector< _Ty, _Ax >::operator[] ( size_type  _Index) const
inline

Provides read access to 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.

Parameters
_IndexThe index of the element to be retrieved.
Returns
A const reference to the item at the given index.

The version of operator [] that returns a non-const reference 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.

912  {
913  return _Internal_subscript(_Index);
914  }
_In_ size_t _In_ int _Index
Definition: time.h:102
_Ty & _Internal_subscript(size_type _Index) const
Definition: concurrent_vector.h:1575
template<typename _Ty , class _Ax >
iterator Concurrency::concurrent_vector< _Ty, _Ax >::push_back ( const_reference  _Item)
inline

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

Parameters
_ItemThe value to be appended.
Returns
An iterator to item appended.
844  {
845  size_type _K;
846  void *_Ptr = _Internal_push_back(sizeof(_Ty), _K);
847  _Internal_loop_guide _Loop(1, _Ptr);
848  _Loop._Init(&_Item);
849  return iterator(*this, _K, _Ptr);
850  }
details::_Vector_iterator< concurrent_vector, _Ty > iterator
A type that provides a random-access iterator that can read any element in a concurrent vector...
Definition: concurrent_vector.h:489
_CONCRTIMP void * _Internal_push_back(_Size_type _Element_size, _Size_type &_Index)
details::_Concurrent_vector_base_v4::_Size_type size_type
A type that counts the number of elements in a concurrent vector.
Definition: concurrent_vector.h:439
template<typename _Ty , class _Ax >
iterator Concurrency::concurrent_vector< _Ty, _Ax >::push_back ( _Ty &&  _Item)
inline

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

Parameters
_ItemThe value to be appended.
Returns
An iterator to item appended.
863  {
864  size_type _K;
865  void *_Ptr = _Internal_push_back(sizeof(_Ty), _K);
866  new (_Ptr) _Ty( std::move(_Item));
867  return iterator(*this, _K, _Ptr);
868  }
details::_Vector_iterator< concurrent_vector, _Ty > iterator
A type that provides a random-access iterator that can read any element in a concurrent vector...
Definition: concurrent_vector.h:489
_CONCRTIMP void * _Internal_push_back(_Size_type _Element_size, _Size_type &_Index)
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
details::_Concurrent_vector_base_v4::_Size_type size_type
A type that counts the number of elements in a concurrent vector.
Definition: concurrent_vector.h:439
template<typename _Ty , class _Ax >
reverse_iterator Concurrency::concurrent_vector< _Ty, _Ax >::rbegin ( )
inline

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

Returns
An iterator of type reverse_iterator or const_reverse_iterator to the beginning of the concurrent vector.
1168  {
1169  return reverse_iterator(end());
1170  }
std::reverse_iterator< iterator > reverse_iterator
A type that provides a random-access iterator that can read any element in a reversed concurrent vect...
Definition: concurrent_vector.h:502
iterator end()
Returns an iterator of type iterator or const_iterator to the end of the concurrent vector...
Definition: concurrent_vector.h:1125
template<typename _Ty , class _Ax >
const_reverse_iterator Concurrency::concurrent_vector< _Ty, _Ax >::rbegin ( ) const
inline

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

Returns
An iterator of type reverse_iterator or const_reverse_iterator to the beginning of the concurrent vector.
1196  {
1197  return const_reverse_iterator(end());
1198  }
std::reverse_iterator< const_iterator > const_reverse_iterator
A type that provides a random-access iterator that can read any const element in the concurrent vecto...
Definition: concurrent_vector.h:508
iterator end()
Returns an iterator of type iterator or const_iterator to the end of the concurrent vector...
Definition: concurrent_vector.h:1125
template<typename _Ty , class _Ax >
reverse_iterator Concurrency::concurrent_vector< _Ty, _Ax >::rend ( )
inline

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

Returns
An iterator of type reverse_iterator or const_reverse_iterator to the end of the concurrent vector.
1182  {
1183  return reverse_iterator(begin());
1184  }
iterator begin()
Returns an iterator of type iterator or const_iterator to the beginning of the concurrent vector...
Definition: concurrent_vector.h:1111
std::reverse_iterator< iterator > reverse_iterator
A type that provides a random-access iterator that can read any element in a reversed concurrent vect...
Definition: concurrent_vector.h:502
template<typename _Ty , class _Ax >
const_reverse_iterator Concurrency::concurrent_vector< _Ty, _Ax >::rend ( ) const
inline

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

Returns
An iterator of type reverse_iterator or const_reverse_iterator to the end of the concurrent vector.
1210  {
1211  return const_reverse_iterator(begin());
1212  }
iterator begin()
Returns an iterator of type iterator or const_iterator to the beginning of the concurrent vector...
Definition: concurrent_vector.h:1111
std::reverse_iterator< const_iterator > const_reverse_iterator
A type that provides a random-access iterator that can read any const element in the concurrent vecto...
Definition: concurrent_vector.h:508
template<typename _Ty , class _Ax >
void Concurrency::concurrent_vector< _Ty, _Ax >::reserve ( size_type  _N)
inline

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

Parameters
_NThe number of elements to reserve space for.

reserve is not concurrency-safe. You must ensure that no other threads are invoking methods on the concurrent vector when you call this method. The capacity of the concurrent vector after the method returns may be bigger than the requested reservation.

1027  {
1028  if( _N )
1029  _Internal_reserve(_N, sizeof(_Ty), max_size());
1030  }
_In_ size_t _Deref_pre_opt_z_ char const _In_ size_t _N
Definition: wchar.h:78
size_type max_size() const
Returns the maximum number of elements the concurrent vector can hold. This method is concurrency-saf...
Definition: concurrent_vector.h:1097
_CONCRTIMP void _Internal_reserve(_Size_type _N, _Size_type _Element_size, _Size_type _Max_size)
template<typename _Ty , class _Ax >
void Concurrency::concurrent_vector< _Ty, _Ax >::resize ( size_type  _N)
inline

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

Parameters
_NThe new size of the concurrent vector.

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.

1061  {
1063  }
_In_ size_t _Deref_pre_opt_z_ char const _In_ size_t _N
Definition: wchar.h:78
static void __cdecl _Initialize_array(void *_Begin, const void *, size_type _N)
Definition: concurrent_vector.h:1659
size_type max_size() const
Returns the maximum number of elements the concurrent vector can hold. This method is concurrency-saf...
Definition: concurrent_vector.h:1097
static void __cdecl _Destroy_array(void *_Begin, size_type _N)
Definition: concurrent_vector.h:1685
_CONCRTIMP void _Internal_resize(_Size_type _New_size, _Size_type _Element_size, _Size_type _Max_size, _My_internal_array_op1 _Destroy, _My_internal_array_op2 _Init, const void *_Src)
#define NULL
Definition: corecrt.h:158
template<typename _Ty , class _Ax >
void Concurrency::concurrent_vector< _Ty, _Ax >::resize ( size_type  _N,
const _Ty &  _Val 
)
inline

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

Parameters
_NThe new size of the concurrent_vector.
_ValThe value of new elements added to the vector if the new size is larger than the original size. If the value is omitted, the new objects are assigned the default value for their type.

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.

1086  {
1087  _Internal_resize( _N, sizeof(_Ty), max_size(), _Destroy_array, _Initialize_array_by, static_cast<const void*>(&_Val) );
1088  }
_In_ size_t _Deref_pre_opt_z_ char const _In_ size_t _N
Definition: wchar.h:78
static void __cdecl _Initialize_array_by(void *_Begin, const void *_Src, size_type _N)
Definition: concurrent_vector.h:1665
size_type max_size() const
Returns the maximum number of elements the concurrent vector can hold. This method is concurrency-saf...
Definition: concurrent_vector.h:1097
_FwdIt const _Ty _Val
Definition: algorithm:1938
static void __cdecl _Destroy_array(void *_Begin, size_type _N)
Definition: concurrent_vector.h:1685
_CONCRTIMP void _Internal_resize(_Size_type _New_size, _Size_type _Element_size, _Size_type _Max_size, _My_internal_array_op1 _Destroy, _My_internal_array_op2 _Init, const void *_Src)
template<typename _Ty , class _Ax >
void Concurrency::concurrent_vector< _Ty, _Ax >::shrink_to_fit ( )

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

Compacts the internal representation of the concurrent vector to reduce fragmentation and optimize memory usage.

This method will internally re-allocate memory move elements around, invalidating all the iterators. shrink_to_fit is not concurrency-safe. You must ensure that no other threads are invoking methods on the concurrent vector when you call this function.

1537 {
1538  _Internal_segments_table _Old = { 0, nullptr };
1539  try
1540  {
1541  if( _Internal_compact( sizeof(_Ty), &_Old, &_Destroy_array, &_Copy_array ) )
1542  _Internal_free_segments( _Old._Table, _Pointers_per_long_table, _Old._First_block ); // Free joined and unnecessary segments
1543  }
1544  catch(...)
1545  {
1546  if( _Old._First_block ) // Free segment allocated for compacting. Only for support of exceptions in ctor of user _Ty[pe]
1547  _Internal_free_segments( _Old._Table, 1, _Old._First_block );
1548  throw;
1549  }
1550 }
static const _Segment_index_t _Pointers_per_long_table
Definition: concurrent_vector.h:78
static void __cdecl _Copy_array(void *_Dst, const void *_Src, size_type _N)
Definition: concurrent_vector.h:1671
_CONCRTIMP void * _Internal_compact(_Size_type _Element_size, void *_Table, _My_internal_array_op1 _Destroy, _My_internal_array_op2 _Copy)
void _Internal_free_segments(void *_Table[], _Segment_index_t _K, _Segment_index_t _First_block)
Definition: concurrent_vector.h:1553
static void __cdecl _Destroy_array(void *_Begin, size_type _N)
Definition: concurrent_vector.h:1685
template<typename _Ty , class _Ax >
size_type Concurrency::concurrent_vector< _Ty, _Ax >::size ( ) const
inline

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

Returns
The number of elements in this concurrent_vector object.

The returned size is guaranteed to include all elements appended by calls to the function push_back, or grow operations that have completed prior to invoking this method. However, it may also include elements that are allocated but still under construction by concurrent calls to any of the growth methods.

979  {
982  return _Cp < _Sz ? _Cp : _Sz;
983  }
_CONCRTIMP _Size_type _Internal_capacity() const
_Subatomic< _Size_type > _My_early_size
Definition: concurrent_vector.h:160
details::_Concurrent_vector_base_v4::_Size_type size_type
A type that counts the number of elements in a concurrent vector.
Definition: concurrent_vector.h:439
template<typename _Ty , class _Ax >
void Concurrency::concurrent_vector< _Ty, _Ax >::swap ( concurrent_vector< _Ty, _Ax > &  _Vector)
inline

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

Parameters
_VectorThe concurrent_vector object to swap contents with.
1392  {
1393  if( this != &_Vector )
1394  {
1395  _Concurrent_vector_base_v4::_Internal_swap(static_cast<_Concurrent_vector_base_v4&>(_Vector));
1396  std::swap(this->_My_allocator, _Vector._My_allocator);
1397  }
1398  }
void swap(concurrent_vector< _Ty, _Ax > &_A, concurrent_vector< _Ty, _Ax > &_B)
Exchanges the elements of two concurrent_vector objects.
Definition: concurrent_vector.h:1962
_Allocator_type _My_allocator
Definition: concurrent_vector.h:391

Friends And Related Function Documentation

template<typename _Ty , class _Ax >
template<typename _C , typename _U >
friend class details::_Vector_iterator
friend

The documentation for this class was generated from the following file: