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 ()
 
_CRTIMP2 ~_Concurrent_vector_base_v4 ()
 
_CRTIMP2 void _Internal_reserve (_Size_type _N, _Size_type _Element_size, _Size_type _Max_size)
 
_CRTIMP2 _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)
 
_CRTIMP2 _Size_type _Internal_grow_by (_Size_type _Delta, _Size_type _Element_size, _My_internal_array_op2 _Init, const void *_Src)
 
_CRTIMP2 void_Internal_push_back (_Size_type _Element_size, _Size_type &_Index)
 
_CRTIMP2 _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)
 
_CRTIMP2 void_Internal_compact (_Size_type _Element_size, void *_Table, _My_internal_array_op1 _Destroy, _My_internal_array_op2 _Copy)
 
_CRTIMP2 void _Internal_copy (const _Concurrent_vector_base_v4 &_Src, _Size_type _Element_size, _My_internal_array_op2 _Copy)
 
_CRTIMP2 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)
 
_CRTIMP2 void _Internal_throw_exception (_Size_type) const
 
_CRTIMP2 void _Internal_swap (_Concurrent_vector_base_v4 &)
 
_CRTIMP2 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)
 
_CRTIMP2 _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 _CRTIMP2 _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 (const _Allocator_type &_Al=_Allocator_type())
 
- 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 ).

522  : details::_Allocator_base<_Ty, _Ax>(_Al)
523  {
525  }
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:1423
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 ).

546  : details::_Allocator_base<_Ty, _Ax>(_Vector.get_allocator())
547  {
549  _Internal_copy(_Vector, sizeof(_Ty), &_Copy_array);
550  }
void *__cdecl * _My_vector_allocator_ptr(_Concurrent_vector_base_v4 &, size_t)
_CRTIMP2 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:1664
static void *__cdecl _Internal_allocator(::Concurrency::details::_Concurrent_vector_base_v4 &_Vb, size_t _K)
Definition: concurrent_vector.h:1423
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 ).

578  : details::_Allocator_base<_Ty, _Ax>(_Al)
579  {
581  _Internal_copy(_Vector._Internal_vector_base(), sizeof(_Ty), &_Copy_array);
582  }
void *__cdecl * _My_vector_allocator_ptr(_Concurrent_vector_base_v4 &, size_t)
_CRTIMP2 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:1664
static void *__cdecl _Internal_allocator(::Concurrency::details::_Concurrent_vector_base_v4 &_Vb, size_t _K)
Definition: concurrent_vector.h:1423
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 ).

604  : details::_Allocator_base<_Ty, _Ax>(_Vector.get_allocator())
605  {
607  _Concurrent_vector_base_v4::_Internal_swap(_Vector._Internal_vector_base());
608  }
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:1423
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 ).

629  {
631  if ( !_N ) return;
632  _Internal_reserve(_N, sizeof(_Ty), max_size()); _My_early_size = _N;
634  _Initialize_array(static_cast<_Ty*>(_My_segment[0]._My_array), NULL, _N);
635  }
void *__cdecl * _My_vector_allocator_ptr(_Concurrent_vector_base_v4 &, size_t)
#define _CONCRT_ASSERT(x)
Definition: concrt.h:137
_N
Definition: wchar.h:1269
#define NULL
Definition: crtdbg.h:30
static void __cdecl _Initialize_array(void *_Begin, const void *, size_type _N)
Definition: concurrent_vector.h:1652
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:1090
_Subatomic< _Size_type > _My_early_size
Definition: concurrent_vector.h:158
static void *__cdecl _Internal_allocator(::Concurrency::details::_Concurrent_vector_base_v4 &_Vb, size_t _K)
Definition: concurrent_vector.h:1423
_Subatomic< _Size_type > _My_first_block
Definition: concurrent_vector.h:155
static _CRTIMP2 _Segment_index_t __cdecl _Segment_index_of(_Size_type _Index)
_Subatomic< _Segment_t * > _My_segment
Definition: concurrent_vector.h:161
_CRTIMP2 void _Internal_reserve(_Size_type _N, _Size_type _Element_size, _Size_type _Max_size)
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 ).

662  : details::_Allocator_base<_Ty, _Ax>(_Al)
663  {
665  _Internal_assign( _N, _Item );
666  }
void *__cdecl * _My_vector_allocator_ptr(_Concurrent_vector_base_v4 &, size_t)
_N
Definition: wchar.h:1269
static void *__cdecl _Internal_allocator(::Concurrency::details::_Concurrent_vector_base_v4 &_Vb, size_t _K)
Definition: concurrent_vector.h:1423
void _Internal_assign(size_type _N, const_reference _Item)
Definition: concurrent_vector.h:1597
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 ).

697  : details::_Allocator_base<_Ty, _Ax>(_Al)
698  {
700  _Internal_assign(_Begin, _End, static_cast<_Is_integer_tag<std::numeric_limits<_InputIterator>::is_integer> *>(0) );
701  }
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:1423
void _Internal_assign(size_type _N, const_reference _Item)
Definition: concurrent_vector.h:1597
template<typename _Ty , class _Ax >
Concurrency::concurrent_vector< _Ty, _Ax >::~concurrent_vector ( )
inline

Erases all elements and destroys this concurrent vector.

1412  {
1413  _Segment_t *_Table = _My_segment;
1414  _Internal_free_segments( reinterpret_cast<void**>(_Table), _Internal_clear(&_Destroy_array), _My_first_block );
1415  // base class destructor call
1416  }
_CRTIMP2 _Segment_index_t _Internal_clear(_My_internal_array_op1 _Destroy)
_Subatomic< _Size_type > _My_first_block
Definition: concurrent_vector.h:155
void _Internal_free_segments(void *_Table[], _Segment_index_t _K, _Segment_index_t _First_block)
Definition: concurrent_vector.h:1546
_Subatomic< _Segment_t * > _My_segment
Definition: concurrent_vector.h:161
static void __cdecl _Destroy_array(void *_Begin, size_type _N)
Definition: concurrent_vector.h:1678

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
1670 {
1671  _Internal_loop_guide _Loop(_N, _Dst); _Loop._Assign(_Src);
1672 }
_N
Definition: wchar.h:1269
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
template<typename _Ty , class _Ax >
void __cdecl Concurrency::concurrent_vector< _Ty, _Ax >::_Copy_array ( void _Dst,
const void _Src,
size_type  _N 
)
staticprivate
1664  {
1665  _Internal_loop_guide _Loop(_N, _Dst); _Loop._Copy(_Src);
1666 }
_N
Definition: wchar.h:1269
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
template<typename _Ty , class _Ax >
void __cdecl Concurrency::concurrent_vector< _Ty, _Ax >::_Destroy_array ( void _Begin,
size_type  _N 
)
staticprivate
1679 {
1680  _Ty* _Array = static_cast<_Ty*>(_Begin);
1681  for( size_type _J=_N; _J>0; --_J )
1682  _Array[_J-1].~_Ty(); // destructors are supposed to not throw any exceptions
1683 }
_N
Definition: wchar.h:1269
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:432
template<typename _Ty , class _Ax >
void __cdecl Concurrency::concurrent_vector< _Ty, _Ax >::_Initialize_array ( void _Begin,
const void ,
size_type  _N 
)
staticprivate
1653 {
1654  _Internal_loop_guide _Loop(_N, _Begin); _Loop._Init();
1655 }
_N
Definition: wchar.h:1269
template<typename _Ty , class _Ax >
void __cdecl Concurrency::concurrent_vector< _Ty, _Ax >::_Initialize_array_by ( void _Begin,
const void _Src,
size_type  _N 
)
staticprivate
1659 {
1660  _Internal_loop_guide _Loop(_N, _Begin); _Loop._Init(_Src);
1661 }
_N
Definition: wchar.h:1269
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
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
1424  {
1425  return static_cast<concurrent_vector<_Ty, _Ax>&>(_Vb)._My_allocator.allocate(_K);
1426  }
_Allocator_type _My_allocator
Definition: concurrent_vector.h:389
template<typename _Ty , class _Ax >
void Concurrency::concurrent_vector< _Ty, _Ax >::_Internal_assign ( size_type  _N,
const_reference  _Item 
)
private
1598 {
1600  if( !_N )
1601  return;
1602  _Internal_reserve(_N, sizeof(_Ty), max_size());
1603  _My_early_size = _N;
1604  _Segment_index_t _K = 0;
1606  while (_Sz < _N)
1607  {
1608  _Initialize_array_by(static_cast<_Ty*>(_My_segment[_K]._My_array), static_cast<const void*>(&_Item), _Sz);
1609  _N -= _Sz;
1610  if (!_K)
1611  {
1612  _K = _My_first_block;
1613  }
1614  else {
1615  ++_K;
1616  _Sz <<= 1;
1617  }
1618  }
1619  _Initialize_array_by(static_cast<_Ty*>(_My_segment[_K]._My_array), static_cast<const void*>(&_Item), _N);
1620 }
size_t _Size_type
Definition: concurrent_vector.h:69
#define _CONCRT_ASSERT(x)
Definition: concrt.h:137
_N
Definition: wchar.h:1269
static _Size_type _Segment_size(_Segment_index_t _K)
Definition: concurrent_vector.h:118
static void __cdecl _Initialize_array_by(void *_Begin, const void *_Src, size_type _N)
Definition: concurrent_vector.h:1658
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:1090
size_t _Segment_index_t
Definition: concurrent_vector.h:68
_Subatomic< _Size_type > _My_early_size
Definition: concurrent_vector.h:158
_Subatomic< _Size_type > _My_first_block
Definition: concurrent_vector.h:155
_Subatomic< _Segment_t * > _My_segment
Definition: concurrent_vector.h:161
_CRTIMP2 void _Internal_reserve(_Size_type _N, _Size_type _Element_size, _Size_type _Max_size)
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
1445  {
1446  _Internal_assign(static_cast<size_type>(_First), static_cast<_Ty>(_Last));
1447  }
_FwdIt _Last
Definition: algorithm:1936
void _Internal_assign(size_type _N, const_reference _Item)
Definition: concurrent_vector.h:1597
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
1450  {
1452  }
void internal_assign_iterators(_I _First, _I _Last)
Definition: concurrent_vector.h:1623
_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
1547 {
1548  // Free the arrays
1549  while( _K > _First_block )
1550  {
1551  --_K;
1552  _Ty* _Array = static_cast<_Ty*>(_Table[_K]);
1553  _Table[_K] = NULL;
1554  if( _Array > _BAD_ALLOC_MARKER ) // check for correct segment pointer
1555  this->_My_allocator.deallocate( _Array, _Segment_size(_K) );
1556  }
1557  _Ty* _Array = static_cast<_Ty*>(_Table[0]);
1558  if( _Array > _BAD_ALLOC_MARKER )
1559  {
1560  _CONCRT_ASSERT( _First_block > 0 );
1561  while(_K > 0)
1562  _Table[--_K] = NULL;
1563  this->_My_allocator.deallocate( _Array, _Segment_size(_First_block) );
1564  }
1565 }
#define _CONCRT_ASSERT(x)
Definition: concrt.h:137
static _Size_type _Segment_size(_Segment_index_t _K)
Definition: concurrent_vector.h:118
#define NULL
Definition: crtdbg.h:30
#define _BAD_ALLOC_MARKER
Definition: concurrent_vector.h:60
_Allocator_type _My_allocator
Definition: concurrent_vector.h:389
template<typename _Ty , class _Ax >
_Ty & Concurrency::concurrent_vector< _Ty, _Ax >::_Internal_subscript ( size_type  _Index) const
private
1569 {
1570  _CONCRT_ASSERT( _Index<_My_early_size ); // index out of bounds
1571  size_type _J = _Index;
1573  _CONCRT_ASSERT( _My_segment != (_Segment_t*)_My_storage || _K < _Pointers_per_short_table ); // index is under construction
1574  // no need in load_with_acquire because the thread works in its own space or gets
1575  _Ty* _Array = static_cast<_Ty*>(_My_segment[_K]._My_array);
1576  _CONCRT_ASSERT( _Array != _BAD_ALLOC_MARKER ); // instance may be broken by bad allocation; use at() instead
1577  _CONCRT_ASSERT( _Array != NULL ); // index is being allocated
1578  return _Array[_J];
1579 }
#define _CONCRT_ASSERT(x)
Definition: concrt.h:137
static _Segment_index_t _Segment_base_index_of(_Segment_index_t &_Index)
Definition: concurrent_vector.h:111
#define NULL
Definition: crtdbg.h:30
size_t _Segment_index_t
Definition: concurrent_vector.h:68
_Subatomic< _Size_type > _My_early_size
Definition: concurrent_vector.h:158
static const _Segment_index_t _Pointers_per_short_table
Definition: concurrent_vector.h:75
_Segment_t _My_storage[_Pointers_per_short_table]
Definition: concurrent_vector.h:90
#define _BAD_ALLOC_MARKER
Definition: concurrent_vector.h:60
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:432
_Subatomic< _Segment_t * > _My_segment
Definition: concurrent_vector.h:161
template<typename _Ty , class _Ax >
_Ty & Concurrency::concurrent_vector< _Ty, _Ax >::_Internal_subscript_with_exceptions ( size_type  _Index) const
private
1583 {
1584  if( _Index >= _My_early_size )
1585  _Internal_throw_exception(0); // throw std::out_of_range
1586  size_type _J = _Index;
1588  if( _My_segment == (_Segment_t*)_My_storage && _K >= _Pointers_per_short_table )
1589  _Internal_throw_exception(1); // throw std::out_of_range
1590  void *_Array = _My_segment[_K]._My_array; // no need in load_with_acquire
1591  if( _Array <= _BAD_ALLOC_MARKER ) // check for correct segment pointer
1592  _Internal_throw_exception(2); // throw std::range_error
1593  return static_cast<_Ty*>(_Array)[_J];
1594 }
_CRTIMP2 void _Internal_throw_exception(_Size_type) const
static _Segment_index_t _Segment_base_index_of(_Segment_index_t &_Index)
Definition: concurrent_vector.h:111
size_t _Segment_index_t
Definition: concurrent_vector.h:68
_Subatomic< _Size_type > _My_early_size
Definition: concurrent_vector.h:158
static const _Segment_index_t _Pointers_per_short_table
Definition: concurrent_vector.h:75
_Segment_t _My_storage[_Pointers_per_short_table]
Definition: concurrent_vector.h:90
#define _BAD_ALLOC_MARKER
Definition: concurrent_vector.h:60
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:432
_Subatomic< _Segment_t * > _My_segment
Definition: concurrent_vector.h:161
template<typename _Ty , class _Ax >
const ::Concurrency::details::_Concurrent_vector_base_v4& Concurrency::concurrent_vector< _Ty, _Ax >::_Internal_vector_base ( ) const
inline
1418 { return *this; }
template<typename _Ty , class _Ax >
::Concurrency::details::_Concurrent_vector_base_v4& Concurrency::concurrent_vector< _Ty, _Ax >::_Internal_vector_base ( )
inline
1419 { 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.

1346  {
1347  clear();
1348  _Internal_assign( _N, _Item );
1349  }
_N
Definition: wchar.h:1269
void clear()
Erases all elements in the concurrent vector. This method is not concurrency-safe.
Definition: concurrent_vector.h:1402
void _Internal_assign(size_type _N, const_reference _Item)
Definition: concurrent_vector.h:1597
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.

1372  {
1373  clear();
1374  _Internal_assign( _Begin, _End, static_cast<_Is_integer_tag<std::numeric_limits<_InputIterator>::is_integer> *>(0) );
1375  }
void clear()
Erases all elements in the concurrent vector. This method is not concurrency-safe.
Definition: concurrent_vector.h:1402
void _Internal_assign(size_type _N, const_reference _Item)
Definition: concurrent_vector.h:1597
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.

930  {
932  }
_Ty & _Internal_subscript_with_exceptions(size_type _Index) const
Definition: concurrent_vector.h:1582
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.

955  {
957  }
_Ty & _Internal_subscript_with_exceptions(size_type _Index) const
Definition: concurrent_vector.h:1582
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.
1296  {
1297  _Size_type sz = size();
1298  _CONCRT_ASSERT( sz > 0 );
1299  return _Internal_subscript( sz-1 );
1300  }
size_t _Size_type
Definition: concurrent_vector.h:69
#define _CONCRT_ASSERT(x)
Definition: concrt.h:137
_Ty & _Internal_subscript(size_type _Index) const
Definition: concurrent_vector.h:1568
size_type size() const
Returns the number of elements in the concurrent vector. This method is concurrency-safe.
Definition: concurrent_vector.h:971
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.
1311  {
1312  _Size_type sz = size();
1313  _CONCRT_ASSERT( sz > 0 );
1314  return _Internal_subscript( sz-1 );
1315  }
size_t _Size_type
Definition: concurrent_vector.h:69
#define _CONCRT_ASSERT(x)
Definition: concrt.h:137
_Ty & _Internal_subscript(size_type _Index) const
Definition: concurrent_vector.h:1568
size_type size() const
Returns the number of elements in the concurrent vector. This method is concurrency-safe.
Definition: concurrent_vector.h:971
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.
1105  {
1106  return iterator(*this,0);
1107  }
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:482
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.
1133  {
1134  return const_iterator(*this,0);
1135  }
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:488
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.

1002  {
1003  return _Internal_capacity();
1004  }
_CRTIMP2 _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.
1216  {
1217  return (((const _Myt *)this)->begin());
1218  }
concurrent_vector< _Ty, _Ax > _Myt
Definition: concurrent_vector.h:421
iterator begin()
Returns an iterator of type iterator or const_iterator to the beginning of the concurrent vector...
Definition: concurrent_vector.h:1104
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.
1229  {
1230  return (((const _Myt *)this)->end());
1231  }
concurrent_vector< _Ty, _Ax > _Myt
Definition: concurrent_vector.h:421
iterator end()
Returns an iterator of type iterator or const_iterator to the end of the concurrent vector...
Definition: concurrent_vector.h:1118
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.

1403  {
1405  }
_CRTIMP2 _Segment_index_t _Internal_clear(_My_internal_array_op1 _Destroy)
static void __cdecl _Destroy_array(void *_Begin, size_type _N)
Definition: concurrent_vector.h:1678
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.
1242  {
1243  return (((const _Myt *)this)->rbegin());
1244  }
reverse_iterator rbegin()
Returns an iterator of type reverse_iterator or const_reverse_iterator to the beginning of the conc...
Definition: concurrent_vector.h:1160
concurrent_vector< _Ty, _Ax > _Myt
Definition: concurrent_vector.h:421
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.
1255  {
1256  return (((const _Myt *)this)->rend());
1257  }
reverse_iterator rend()
Returns an iterator of type reverse_iterator or const_reverse_iterator to the end of the concurrent...
Definition: concurrent_vector.h:1174
concurrent_vector< _Ty, _Ax > _Myt
Definition: concurrent_vector.h:421
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.
986  {
987  return !_My_early_size;
988  }
_Subatomic< _Size_type > _My_early_size
Definition: concurrent_vector.h:158
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.
1119  {
1120  return iterator(*this,size());
1121  }
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:482
size_type size() const
Returns the number of elements in the concurrent vector. This method is concurrency-safe.
Definition: concurrent_vector.h:971
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.
1147  {
1148  return const_iterator(*this,size());
1149  }
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:488
size_type size() const
Returns the number of elements in the concurrent vector. This method is concurrency-safe.
Definition: concurrent_vector.h:971
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.
1268  {
1269  _CONCRT_ASSERT( size()>0 );
1270  return static_cast<_Ty*>(_My_segment[0]._My_array)[0];
1271  }
#define _CONCRT_ASSERT(x)
Definition: concrt.h:137
_Subatomic< _Segment_t * > _My_segment
Definition: concurrent_vector.h:161
size_type size() const
Returns the number of elements in the concurrent vector. This method is concurrency-safe.
Definition: concurrent_vector.h:971
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.
1282  {
1283  _CONCRT_ASSERT( size()>0 );
1284  return static_cast<_Ty*>(_My_segment[0]._My_array)[0];
1285  }
#define _CONCRT_ASSERT(x)
Definition: concrt.h:137
_Subatomic< _Segment_t * > _My_segment
Definition: concurrent_vector.h:161
size_type size() const
Returns the number of elements in the concurrent vector. This method is concurrency-safe.
Definition: concurrent_vector.h:971
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.
1325  {
1326  return this->_My_allocator;
1327  }
_Allocator_type _My_allocator
Definition: concurrent_vector.h:389
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.

778  {
779  return iterator(*this, _Delta ? _Internal_grow_by( _Delta, sizeof(_Ty), &_Initialize_array, NULL ) : _My_early_size);
780  }
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:482
#define NULL
Definition: crtdbg.h:30
static void __cdecl _Initialize_array(void *_Begin, const void *, size_type _N)
Definition: concurrent_vector.h:1652
_Subatomic< _Size_type > _My_early_size
Definition: concurrent_vector.h:158
_CRTIMP2 _Size_type _Internal_grow_by(_Size_type _Delta, _Size_type _Element_size, _My_internal_array_op2 _Init, const void *_Src)
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.

799  {
800  return iterator(*this, _Delta ? _Internal_grow_by( _Delta, sizeof(_Ty), &_Initialize_array_by, static_cast<const void*>(&_Item) ) : _My_early_size);
801  }
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:482
static void __cdecl _Initialize_array_by(void *_Begin, const void *_Src, size_type _N)
Definition: concurrent_vector.h:1658
_Subatomic< _Size_type > _My_early_size
Definition: concurrent_vector.h:158
_CRTIMP2 _Size_type _Internal_grow_by(_Size_type _Delta, _Size_type _Element_size, _My_internal_array_op2 _Init, const void *_Src)
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.
815  {
816  size_type _M = 0;
817  if( _N )
818  {
820  if( _M > _N )
821  _M = _N;
822  }
823  return iterator(*this, _M);
824  };
_N
Definition: wchar.h:1269
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:482
#define NULL
Definition: crtdbg.h:30
static void __cdecl _Initialize_array(void *_Begin, const void *, size_type _N)
Definition: concurrent_vector.h:1652
_CRTIMP2 _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)
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:432
template<typename _Ty , class _Ax >
template<class _I >
void Concurrency::concurrent_vector< _Ty, _Ax >::internal_assign_iterators ( _I  _First,
_I  _Last 
)
private
1624 {
1626  size_type _N = std::distance(_First, _Last);
1627  if( !_N ) return;
1628  _Internal_reserve(_N, sizeof(_Ty), max_size());
1629  _My_early_size = _N;
1630  _Segment_index_t _K = 0;
1632  while (_Sz < _N)
1633  {
1634  _Internal_loop_guide _Loop(_Sz, _My_segment[_K]._My_array);
1635  _Loop._Iterate(_First);
1636  _N -= _Sz;
1637  if (!_K)
1638  {
1639  _K = _My_first_block;
1640  }
1641  else {
1642  ++_K;
1643  _Sz <<= 1;
1644  }
1645  }
1646 
1647  _Internal_loop_guide _Loop(_N, _My_segment[_K]._My_array);
1648  _Loop._Iterate(_First);
1649 }
size_t _Size_type
Definition: concurrent_vector.h:69
#define _CONCRT_ASSERT(x)
Definition: concrt.h:137
_N
Definition: wchar.h:1269
static _Size_type _Segment_size(_Segment_index_t _K)
Definition: concurrent_vector.h:118
iterator_traits< _InIt >::difference_type distance(_InIt _First, _InIt _Last)
Definition: xutility:755
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:1090
size_t _Segment_index_t
Definition: concurrent_vector.h:68
_Subatomic< _Size_type > _My_early_size
Definition: concurrent_vector.h:158
_Subatomic< _Size_type > _My_first_block
Definition: concurrent_vector.h:155
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:432
_Subatomic< _Segment_t * > _My_segment
Definition: concurrent_vector.h:161
_CRTIMP2 void _Internal_reserve(_Size_type _N, _Size_type _Element_size, _Size_type _Max_size)
_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.
1091  {
1092  return (~size_type(0))/sizeof(_Ty);
1093  }
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:432
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.
714  {
715  if( this != &_Vector )
716  _Concurrent_vector_base_v4::_Internal_assign(_Vector, sizeof(_Ty), &_Destroy_array, &_Assign_array, &_Copy_array);
717  return *this;
718  }
static void __cdecl _Assign_array(void *_Dst, const void *_Src, size_type _N)
Definition: concurrent_vector.h:1669
static void __cdecl _Copy_array(void *_Dst, const void *_Src, size_type _N)
Definition: concurrent_vector.h:1664
static void __cdecl _Destroy_array(void *_Begin, size_type _N)
Definition: concurrent_vector.h:1678
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.
735  {
736  if( static_cast<void*>( this ) != static_cast<const void*>( &_Vector ) )
737  {
738  _Concurrent_vector_base_v4::_Internal_assign(_Vector._Internal_vector_base(),
739  sizeof(_Ty), &_Destroy_array, &_Assign_array, &_Copy_array);
740  }
741  return *this;
742  }
static void __cdecl _Assign_array(void *_Dst, const void *_Src, size_type _N)
Definition: concurrent_vector.h:1669
static void __cdecl _Copy_array(void *_Dst, const void *_Src, size_type _N)
Definition: concurrent_vector.h:1664
static void __cdecl _Destroy_array(void *_Begin, size_type _N)
Definition: concurrent_vector.h:1678
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.
755  {
756  if( static_cast<void*>( this ) != static_cast<const void*>( &_Vector ) )
757  {
758  _Concurrent_vector_base_v4::_Internal_swap(_Vector._Internal_vector_base());
759  _Vector.clear();
760  }
761  return *this;
762  }
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.

882  {
883  return _Internal_subscript(_Index);
884  }
_Ty & _Internal_subscript(size_type _Index) const
Definition: concurrent_vector.h:1568
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.

905  {
906  return _Internal_subscript(_Index);
907  }
_Ty & _Internal_subscript(size_type _Index) const
Definition: concurrent_vector.h:1568
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.
837  {
838  size_type _K;
839  void *_Ptr = _Internal_push_back(sizeof(_Ty), _K);
840  _Internal_loop_guide _Loop(1, _Ptr);
841  _Loop._Init(&_Item);
842  return iterator(*this, _K, _Ptr);
843  }
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:482
_CRTIMP2 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:432
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.
856  {
857  size_type _K;
858  void *_Ptr = _Internal_push_back(sizeof(_Ty), _K);
859  new (_Ptr) _Ty( std::move(_Item));
860  return iterator(*this, _K, _Ptr);
861  }
_OutIt move(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2447
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:482
_CRTIMP2 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:432
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.
1161  {
1162  return reverse_iterator(end());
1163  }
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:495
iterator end()
Returns an iterator of type iterator or const_iterator to the end of the concurrent vector...
Definition: concurrent_vector.h:1118
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.
1189  {
1190  return const_reverse_iterator(end());
1191  }
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:501
iterator end()
Returns an iterator of type iterator or const_iterator to the end of the concurrent vector...
Definition: concurrent_vector.h:1118
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.
1175  {
1176  return reverse_iterator(begin());
1177  }
iterator begin()
Returns an iterator of type iterator or const_iterator to the beginning of the concurrent vector...
Definition: concurrent_vector.h:1104
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:495
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.
1203  {
1204  return const_reverse_iterator(begin());
1205  }
iterator begin()
Returns an iterator of type iterator or const_iterator to the beginning of the concurrent vector...
Definition: concurrent_vector.h:1104
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:501
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.

1020  {
1021  if( _N )
1022  _Internal_reserve(_N, sizeof(_Ty), max_size());
1023  }
_N
Definition: wchar.h:1269
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:1090
_CRTIMP2 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.

1054  {
1056  }
_N
Definition: wchar.h:1269
#define NULL
Definition: crtdbg.h:30
static void __cdecl _Initialize_array(void *_Begin, const void *, size_type _N)
Definition: concurrent_vector.h:1652
_CRTIMP2 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)
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:1090
static void __cdecl _Destroy_array(void *_Begin, size_type _N)
Definition: concurrent_vector.h:1678
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.

1079  {
1080  _Internal_resize( _N, sizeof(_Ty), max_size(), _Destroy_array, _Initialize_array_by, static_cast<const void*>(&_Val) );
1081  }
_N
Definition: wchar.h:1269
_CRTIMP2 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)
static void __cdecl _Initialize_array_by(void *_Begin, const void *_Src, size_type _N)
Definition: concurrent_vector.h:1658
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:1090
_FwdIt const _Ty _Val
Definition: algorithm:1938
static void __cdecl _Destroy_array(void *_Begin, size_type _N)
Definition: concurrent_vector.h:1678
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.

1530 {
1531  _Internal_segments_table _Old = { 0, nullptr };
1532  try
1533  {
1534  if( _Internal_compact( sizeof(_Ty), &_Old, &_Destroy_array, &_Copy_array ) )
1535  _Internal_free_segments( _Old._Table, _Pointers_per_long_table, _Old._First_block ); // Free joined and unnecessary segments
1536  }
1537  catch(...)
1538  {
1539  if( _Old._First_block ) // Free segment allocated for compacting. Only for support of exceptions in ctor of user _Ty[pe]
1540  _Internal_free_segments( _Old._Table, 1, _Old._First_block );
1541  throw;
1542  }
1543 }
static const _Segment_index_t _Pointers_per_long_table
Definition: concurrent_vector.h:76
_CRTIMP2 void * _Internal_compact(_Size_type _Element_size, void *_Table, _My_internal_array_op1 _Destroy, _My_internal_array_op2 _Copy)
static void __cdecl _Copy_array(void *_Dst, const void *_Src, size_type _N)
Definition: concurrent_vector.h:1664
void _Internal_free_segments(void *_Table[], _Segment_index_t _K, _Segment_index_t _First_block)
Definition: concurrent_vector.h:1546
static void __cdecl _Destroy_array(void *_Begin, size_type _N)
Definition: concurrent_vector.h:1678
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.

972  {
975  return _Cp < _Sz ? _Cp : _Sz;
976  }
_CRTIMP2 _Size_type _Internal_capacity() const
_Subatomic< _Size_type > _My_early_size
Definition: concurrent_vector.h:158
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:432
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.
1385  {
1386  if( this != &_Vector )
1387  {
1388  _Concurrent_vector_base_v4::_Internal_swap(static_cast<_Concurrent_vector_base_v4&>(_Vector));
1389  std::swap(this->_My_allocator, _Vector._My_allocator);
1390  }
1391  }
void swap(concurrent_vector< _Ty, _Ax > &_A, concurrent_vector< _Ty, _Ax > &_B)
Exchanges the elements of two concurrent_vector objects.
Definition: concurrent_vector.h:1955
_Allocator_type _My_allocator
Definition: concurrent_vector.h:389

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: