tbb::concurrent_vector< T, A > Class Template Reference
Containers

Concurrent vector container. More...

`#include <concurrent_vector.h>`

Inheritance diagram for tbb::concurrent_vector< T, A >:
Collaboration diagram for tbb::concurrent_vector< T, A >:

## Classes

class | generic_range_type
class | internal_loop_guide
| Exception-aware helper class for filling a segment by exception-danger operators of user class. More...
class | is_integer_tag
| True/false function override helper. More...
struct | push_back_helper

## Public Types

typedef internal::concurrent_vector_base_v3::size_type | size_type
typedef internal::allocator_base< T, A >::allocator_type | allocator_type
typedef T | value_type
typedef ptrdiff_t | difference_type
typedef T & | reference
typedef const T & | const_reference
typedef T * | pointer
typedef const T * | const_pointer
typedef internal::vector_iterator< concurrent_vector, T > | iterator
typedef internal::vector_iterator< concurrent_vector, const T > | const_iterator
typedef std::reverse_iterator< iterator > | reverse_iterator
typedef std::reverse_iterator< const_iterator > | const_reverse_iterator
typedef generic_range_type< iterator > | range_type
typedef generic_range_type< const_iterator > | const_range_type

## Public Member Functions

| concurrent_vector (const allocator_type &a=allocator_type())
| Construct empty vector. More...
| concurrent_vector (std::initializer_list< T > init_list, const allocator_type &a=allocator_type())
| Constructor from initializer_list. More...
| concurrent_vector (const concurrent_vector &vector, const allocator_type &a=allocator_type())
| Copying constructor. More...
| concurrent_vector (concurrent_vector &&source)
| Move constructor. More...
| concurrent_vector (concurrent_vector &&source, const allocator_type &a)
template<class M >
__TBB_DEPRECATED | concurrent_vector (const concurrent_vector< T, M > &vector, const allocator_type &a=allocator_type())
| Copying constructor for vector with different allocator type. More...
| concurrent_vector (size_type n)
| Construction with initial size specified by argument n. More...
| concurrent_vector (size_type n, const_reference t, const allocator_type &a=allocator_type())
| Construction with initial size specified by argument n, initialization by copying of t, and given allocator instance. More...
template<class I >
| concurrent_vector (I first, I last, const allocator_type &a=allocator_type())
| Construction with copying iteration range and given allocator instance. More...
concurrent_vector & | operator= (const concurrent_vector &vector)
| Assignment. More...
concurrent_vector & | operator= (concurrent_vector &&other)
| Move assignment. More...
template<class M >
__TBB_DEPRECATED concurrent_vector & | operator= (const concurrent_vector< T, M > &vector)
| Assignment for vector with different allocator type. More...
concurrent_vector & | operator= (std::initializer_list< T > init_list)
| Assignment for initializer_list. More...
iterator | grow_by (size_type delta)
| Grow by "delta" elements. More...
iterator | grow_by (size_type delta, const_reference t)
| Grow by "delta" elements using copying constructor. More...
template<typename I >
iterator | grow_by (I first, I last)
iterator | grow_by (std::initializer_list< T > init_list)
iterator | grow_to_at_least (size_type n)
| Append minimal sequence of elements such that size()>=n. More...
iterator | grow_to_at_least (size_type n, const_reference t)
iterator | push_back (const_reference item)
| Push item. More...
iterator | push_back (T &&item)
| Push item, move-aware. More...
template<typename... Args>
iterator | emplace_back (Args &&... args)
| Push item, create item "in place" with provided arguments. More...
reference | operator[] (size_type index)
| Get reference to element at given index. More...
const_reference | operator[] (size_type index) const
| Get const reference to element at given index. More...
reference | at (size_type index)
| Get reference to element at given index. Throws exceptions on errors. More...
const_reference | at (size_type index) const
| Get const reference to element at given index. Throws exceptions on errors. More...
range_type | range (size_t grainsize=1)
| Get range for iterating with parallel algorithms. More...
const_range_type | range (size_t grainsize=1) const
| Get const range for iterating with parallel algorithms. More...
size_type | size () const
| Return size of vector. It may include elements under construction. More...
bool | empty () const
| Return false if vector is not empty or has elements under construction at least. More...
size_type | capacity () const
| Maximum size to which array can grow without allocating more memory. Concurrent allocations are not included in the value. More...
void | reserve (size_type n)
| Allocate enough space to grow to size n without having to allocate more memory later. More...
void | resize (size_type n)
| Resize the vector. Not thread-safe. More...
void | resize (size_type n, const_reference t)
| Resize the vector, copy t for new elements. Not thread-safe. More...
void | shrink_to_fit ()
| Optimize memory usage and fragmentation. More...
size_type | max_size () const
| Upper bound on argument to reserve. More...
iterator | begin ()
| start iterator More...
iterator | end ()
| end iterator More...
const_iterator | begin () const
| start const iterator More...
const_iterator | end () const
| end const iterator More...
const_iterator | cbegin () const
| start const iterator More...
const_iterator | cend () const
| end const iterator More...
reverse_iterator | rbegin ()
| reverse start iterator More...
reverse_iterator | rend ()
| reverse end iterator More...
const_reverse_iterator | rbegin () const
| reverse start const iterator More...
const_reverse_iterator | rend () const
| reverse end const iterator More...
const_reverse_iterator | crbegin () const
| reverse start const iterator More...
const_reverse_iterator | crend () const
| reverse end const iterator More...
reference | front ()
| the first item More...
const_reference | front () const
| the first item const More...
reference | back ()
| the last item More...
const_reference | back () const
| the last item const More...
allocator_type | get_allocator () const
| return allocator object More...
void | assign (size_type n, const_reference t)
| assign n items by copying t item More...
template<class I >
void | assign (I first, I last)
| assign range [first, last) More...
void | assign (std::initializer_list< T > init_list)
| assigns an initializer list More...
void | swap (concurrent_vector &vector)
| swap two instances More...
void | clear ()
| Clear container while keeping memory allocated. More...
| ~concurrent_vector ()
| Clear and destroy vector. More...
const internal::concurrent_vector_base_v3 & | internal_vector_base () const
template<typename I >
void | copy_range (void *dst, const void *p_type_erased_iterator, size_type n)

## Private Member Functions

void | internal_free_segments (segment_t table[], segment_index_t k, segment_index_t first_block)
| Free k segments from table. More...
T & | internal_subscript (size_type index) const
| Get reference to element at given index. More...
T & | internal_subscript_with_exceptions (size_type index) const
| Get reference to element at given index with errors checks. More...
void | internal_assign_n (size_type n, const_pointer p)
| assign n items by copying t More...
template<class I >
void | internal_assign_range (I first, I last, is_integer_tag< true > *)
| assign integer items by copying when arguments are treated as iterators. See C++ Standard 2003 23.1.1p9 More...
template<class I >
void | internal_assign_range (I first, I last, is_integer_tag< false > *)
| inline proxy assign by iterators More...
template<class I >
void | internal_assign_iterators (I first, I last)
| assign by iterators More...
Private Member Functions inherited from tbb::internal::concurrent_vector_base_v3
| concurrent_vector_base_v3 ()
__TBB_EXPORTED_METHOD | ~concurrent_vector_base_v3 ()
void __TBB_EXPORTED_METHOD | internal_reserve (size_type n, size_type element_size, size_type max_size)
size_type __TBB_EXPORTED_METHOD | internal_capacity () const
void | internal_grow (size_type start, size_type finish, size_type element_size, internal_array_op2 init, const void *src)
size_type __TBB_EXPORTED_METHOD | internal_grow_by (size_type delta, size_type element_size, internal_array_op2 init, const void *src)
void *__TBB_EXPORTED_METHOD | internal_push_back (size_type element_size, size_type &index)
segment_index_t __TBB_EXPORTED_METHOD | internal_clear (internal_array_op1 destroy)
void *__TBB_EXPORTED_METHOD | internal_compact (size_type element_size, void *table, internal_array_op1 destroy, internal_array_op2 copy)
void __TBB_EXPORTED_METHOD | internal_copy (const concurrent_vector_base_v3 &src, size_type element_size, internal_array_op2 copy)
void __TBB_EXPORTED_METHOD | internal_assign (const concurrent_vector_base_v3 &src, size_type element_size, internal_array_op1 destroy, internal_array_op2 assign, internal_array_op2 copy)
void __TBB_EXPORTED_METHOD | internal_throw_exception (size_type) const
| Obsolete. More...
void __TBB_EXPORTED_METHOD | internal_swap (concurrent_vector_base_v3 &v)
void __TBB_EXPORTED_METHOD | internal_resize (size_type n, size_type element_size, size_type max_size, const void *src, internal_array_op1 destroy, internal_array_op2 init)
size_type __TBB_EXPORTED_METHOD | internal_grow_to_at_least_with_result (size_type new_size, size_type element_size, internal_array_op2 init, const void *src)
void __TBB_EXPORTED_METHOD | internal_grow_to_at_least (size_type new_size, size_type element_size, internal_array_op2 init, const void *src)
| Deprecated entry point for backwards compatibility to TBB 2.1. More...

## Static Private Member Functions

static void * | internal_allocator (internal::concurrent_vector_base_v3 &vb, size_t k)
| Allocate k items. More...
static void __TBB_EXPORTED_FUNC | initialize_array (void *begin, const void *, size_type n)
| Construct n instances of T, starting at "begin". More...
static void __TBB_EXPORTED_FUNC | initialize_array_by (void *begin, const void *src, size_type n)
| Copy-construct n instances of T, starting at "begin". More...
static void __TBB_EXPORTED_FUNC | copy_array (void *dst, const void *src, size_type n)
| Copy-construct n instances of T by copying single element pointed to by src, starting at "dst". More...
static void __TBB_EXPORTED_FUNC | move_array (void *dst, const void *src, size_type n)
| Move-construct n instances of T, starting at "dst" by copying according element of src array. More...
static void __TBB_EXPORTED_FUNC | move_assign_array (void *dst, const void *src, size_type n)
| Move-assign (using operator=) n instances of T, starting at "dst" by assigning according element of src array. More...
template<typename Iterator >
static void __TBB_EXPORTED_FUNC | copy_range (void *dst, const void *p_type_erased_iterator, size_type n)
| Copy-construct n instances of T, starting at "dst" by iterator range of [p_type_erased_iterator, p_type_erased_iterator+n). More...
static void __TBB_EXPORTED_FUNC | assign_array (void *dst, const void *src, size_type n)
| Assign (using operator=) n instances of T, starting at "dst" by assigning according element of src array. More...
static void __TBB_EXPORTED_FUNC | destroy_array (void *begin, size_type n)
| Destroy n instances of T, starting at "begin". More...
Static Private Member Functions inherited from tbb::internal::concurrent_vector_base_v3
static segment_index_t | 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)
static bool | is_first_element_in_segment (size_type element_index)

## Friends

template<typename C , typename U >
class | internal::vector_iterator

## Additional Inherited Members

Protected Types inherited from tbb::internal::allocator_base< T, A >
typedef tbb::internal::allocator_rebind< A, T >::type | allocator_type
Protected Member Functions inherited from tbb::internal::allocator_base< T, A >
| allocator_base (const allocator_type &a=allocator_type())
Protected Attributes inherited from tbb::internal::allocator_base< T, A >
allocator_type | my_allocator
Private Types inherited from tbb::internal::concurrent_vector_base_v3
enum | { default_initial_segments = 1 , pointers_per_short_table = 3 , pointers_per_long_table = sizeof(segment_index_t) * 8 }
typedef size_t | segment_index_t
typedef size_t | size_type
typedef void(__TBB_EXPORTED_FUNC * | internal_array_op1) (void *begin, size_type n)
| An operation on an n-element array starting at begin. More...
typedef void(__TBB_EXPORTED_FUNC * | internal_array_op2) (void *dst, const void *src, size_type n)
| An operation on n-element destination array and n-element source array. More...
Private Attributes inherited from tbb::internal::concurrent_vector_base_v3
void *(* | vector_allocator_ptr )(concurrent_vector_base_v3 &, size_t)
| allocator function pointer More...
atomic< size_type > | my_first_block
| count of segments in the first block More...
atomic< size_type > | my_early_size
| Requested size of vector. More...
atomic< segment_t * > | my_segment
| Pointer to the segments table. More...
segment_t | my_storage [pointers_per_short_table]
| embedded storage of segment pointers More...

## Detailed Description

### template<typename T, class A>
class tbb::concurrent_vector< T, A >

Concurrent vector container.

concurrent_vector is a container having the following main properties:

- It provides random indexed access to its elements. The index of the first element is 0.
- It ensures safe concurrent growing its size (different threads can safely append new elements).
- Adding new elements does not invalidate existing iterators and does not change indices of existing items.

Compatibility
  The class meets all Container Requirements and Reversible Container Requirements from C++ Standard (See ISO/IEC 14882:2003(E), clause 23.1). But it doesn't meet Sequence Requirements due to absence of insert() and erase() methods.

Exception Safety
  Methods working with memory allocation and/or new elements construction can throw an exception if allocator fails to allocate memory or element's default constructor throws one. Concurrent vector's element of type T must conform to the following requirements:
  - Throwing an exception is forbidden for destructor of T.
  - Default constructor of T must not throw an exception OR its non-virtual destructor must safely work when its object memory is zero-initialized.

Otherwise, the program's behavior is undefined.

  If an exception happens inside growth or assignment operation, an instance of the vector becomes invalid unless it is stated otherwise in the method documentation. Invalid state means:
  - There are no guarantees that all items were initialized by a constructor. The rest of items is zero-filled, including item where exception happens.
  - An invalid vector instance cannot be repaired; it is unable to grow anymore.
  - Size and capacity reported by the vector are incorrect, and calculated as if the failed operation were successful.
  - Attempt to access not allocated elements using operator[] or iterators results in access violation or segmentation fault exception, and in case of using at() method a C++ exception is thrown.

If a concurrent grow operation successfully completes, all the elements it has added to the vector will remain valid and accessible even if one of subsequent grow operations fails.

Fragmentation
  Unlike an STL vector, a concurrent_vector does not move existing elements if it needs to allocate more memory. The container is divided into a series of contiguous arrays of elements. The first reservation, growth, or assignment operation determines the size of the first array. Using small number of elements as initial size incurs fragmentation that may increase element access time. Internal layout can be optimized by method compact() that merges several smaller arrays into one solid.

Changes since TBB 2.1
  - Fixed guarantees of concurrent_vector::size() and grow_to_at_least() methods to assure elements are allocated.
  - Methods end()/rbegin()/back() are partly thread-safe since they use size() to get the end of vector
  - Added resize() methods (not thread-safe)
  - Added cbegin/cend/crbegin/crend methods
  - Changed return type of methods grow* and push_back to iterator

Changes since TBB 2.0
  - Implemented exception-safety guarantees
  - Added template argument for allocator
  - Added allocator argument in constructors
  - Faster index calculation
  - First growth call specifies a number of segments to be merged in the first allocation.
  - Fixed memory blow up for swarm of vector's instances of small size
  - Added grow_by(size_type n, const_reference t) growth using copying constructor to init new items.
  - Added STL-like constructors.
  - Added operators ==, < and derivatives
  - Added at() method, approved for using after an exception was thrown inside the vector
  - Added get_allocator() method.
  - Added assign() methods
  - Added compact() method to defragment first segments
  - Added swap() method
  - range() defaults on grainsize = 1 supporting auto grainsize algorithms.

Definition at line 550 of file concurrent_vector.h.

## Member Typedef Documentation

## allocator_type

template<typename T , class A >

typedef internal::allocator_base<T, A>::allocator_type tbb::concurrent_vector< T, A >::allocator_type

Definition at line 575 of file concurrent_vector.h.

## const_iterator

template<typename T , class A >

typedef internal::vector_iterator<concurrent_vector,const T> tbb::concurrent_vector< T, A >::const_iterator

Definition at line 585 of file concurrent_vector.h.

## const_pointer

template<typename T , class A >

typedef const T* tbb::concurrent_vector< T, A >::const_pointer

Definition at line 582 of file concurrent_vector.h.

## const_range_type

template<typename T , class A >

typedef generic_range_type<const_iterator> tbb::concurrent_vector< T, A >::const_range_type

Definition at line 601 of file concurrent_vector.h.

## const_reference

template<typename T , class A >

typedef const T& tbb::concurrent_vector< T, A >::const_reference

Definition at line 580 of file concurrent_vector.h.

## const_reverse_iterator

template<typename T , class A >

typedef std::reverse_iterator<const_iterator> tbb::concurrent_vector< T, A >::const_reverse_iterator

Definition at line 590 of file concurrent_vector.h.

## difference_type

template<typename T , class A >

typedef ptrdiff_t tbb::concurrent_vector< T, A >::difference_type

Definition at line 578 of file concurrent_vector.h.

## iterator

template<typename T , class A >

typedef internal::vector_iterator<concurrent_vector,T> tbb::concurrent_vector< T, A >::iterator

Definition at line 584 of file concurrent_vector.h.

## pointer

template<typename T , class A >

typedef T* tbb::concurrent_vector< T, A >::pointer

Definition at line 581 of file concurrent_vector.h.

## range_type

template<typename T , class A >

typedef generic_range_type<iterator> tbb::concurrent_vector< T, A >::range_type

Definition at line 600 of file concurrent_vector.h.

## reference

template<typename T , class A >

typedef T& tbb::concurrent_vector< T, A >::reference

Definition at line 579 of file concurrent_vector.h.

## reverse_iterator

template<typename T , class A >

typedef std::reverse_iterator<iterator> tbb::concurrent_vector< T, A >::reverse_iterator

Definition at line 589 of file concurrent_vector.h.

## size_type

template<typename T , class A >

typedef internal::concurrent_vector_base_v3::size_type tbb::concurrent_vector< T, A >::size_type

Definition at line 574 of file concurrent_vector.h.

## value_type

template<typename T , class A >

typedef T tbb::concurrent_vector< T, A >::value_type

Definition at line 577 of file concurrent_vector.h.

## Constructor & Destructor Documentation

## concurrent_vector() [1/9]

template<typename T , class A >

tbb::concurrent_vector< T, A >::concurrent_vector | ( | const allocator_type & | a = `allocator_type()` | ) |

inline explicit

Construct empty vector.

Definition at line 608 of file concurrent_vector.h.

: internal::allocator_base<T, A>(a), internal::concurrent_vector_base()
{
vector_allocator_ptr = &internal_allocator;
}
tbb::internal::concurrent_vector_base
concurrent_vector_base_v3 concurrent_vector_base
Definition: concurrent_vector.h:288
tbb::concurrent_vector::internal_allocator
static void * internal_allocator(internal::concurrent_vector_base_v3 &vb, size_t k)
Allocate k items.
Definition: concurrent_vector.h:1032
tbb::internal::concurrent_vector_base_v3::vector_allocator_ptr
void *(* vector_allocator_ptr)(concurrent_vector_base_v3 &, size_t)
allocator function pointer
Definition: concurrent_vector.h:178

References tbb::concurrent_vector< T, A >::internal_allocator(), and tbb::internal::concurrent_vector_base_v3::vector_allocator_ptr.

Here is the call graph for this function:

## concurrent_vector() [2/9]

template<typename T , class A >

tbb::concurrent_vector< T, A >::concurrent_vector | ( | std::initializer_list< T > | init_list,
|  | const allocator_type & | a = `allocator_type()`
| ) |  |

inline

Constructor from initializer_list.

Definition at line 618 of file concurrent_vector.h.

: internal::allocator_base<T, A>(a), internal::concurrent_vector_base()
{
vector_allocator_ptr = &internal_allocator;
__TBB_TRY {
internal_assign_iterators(init_list.begin(), init_list.end());
} __TBB_CATCH(...) {
segment_t *table = my_segment.load<relaxed>();;
internal_free_segments( table, internal_clear(&destroy_array), my_first_block.load<relaxed>());
__TBB_RETHROW();
}
}
__TBB_CATCH
#define __TBB_CATCH(e)
Definition: tbb_stddef.h:284
__TBB_TRY
#define __TBB_TRY
Definition: tbb_stddef.h:283
__TBB_RETHROW
#define __TBB_RETHROW()
Definition: tbb_stddef.h:286
tbb::relaxed
@ relaxed
No ordering.
Definition: atomic.h:61
tbb::concurrent_vector::internal_free_segments
void internal_free_segments(segment_t table[], segment_index_t k, segment_index_t first_block)
Free k segments from table.
Definition: concurrent_vector.h:1216
tbb::concurrent_vector::destroy_array
static void __TBB_EXPORTED_FUNC destroy_array(void *begin, size_type n)
Destroy n instances of T, starting at "begin".
Definition: concurrent_vector.h:1340
tbb::concurrent_vector::internal_assign_iterators
void internal_assign_iterators(I first, I last)
assign by iterators
Definition: concurrent_vector.h:1269
tbb::internal::concurrent_vector_base_v3::internal_clear
segment_index_t __TBB_EXPORTED_METHOD internal_clear(internal_array_op1 destroy)
Definition: concurrent_vector.cpp:501
tbb::internal::concurrent_vector_base_v3::my_segment
atomic< segment_t * > my_segment
Pointer to the segments table.
Definition: concurrent_vector.h:187
tbb::internal::concurrent_vector_base_v3::my_first_block
atomic< size_type > my_first_block
count of segments in the first block
Definition: concurrent_vector.h:181

References __TBB_CATCH, __TBB_RETHROW, __TBB_TRY, tbb::concurrent_vector< T, A >::destroy_array(), tbb::concurrent_vector< T, A >::internal_allocator(), tbb::concurrent_vector< T, A >::internal_assign_iterators(), tbb::internal::concurrent_vector_base_v3::internal_clear(), tbb::concurrent_vector< T, A >::internal_free_segments(), tbb::internal::concurrent_vector_base_v3::my_first_block, tbb::internal::concurrent_vector_base_v3::my_segment, tbb::relaxed, and tbb::internal::concurrent_vector_base_v3::vector_allocator_ptr.

Here is the call graph for this function:

## concurrent_vector() [3/9]

template<typename T , class A >

tbb::concurrent_vector< T, A >::concurrent_vector | ( | const concurrent_vector< T, A > & | vector,
|  | const allocator_type & | a = `allocator_type()`
| ) |  |

inline

Copying constructor.

Definition at line 634 of file concurrent_vector.h.

: internal::allocator_base<T, A>(a), internal::concurrent_vector_base()
{
vector_allocator_ptr = &internal_allocator;
__TBB_TRY {
internal_copy(vector, sizeof(T), &copy_array);
} __TBB_CATCH(...) {
segment_t *table = my_segment.load<relaxed>();
internal_free_segments( table, internal_clear(&destroy_array), my_first_block.load<relaxed>());
__TBB_RETHROW();
}
}
tbb::concurrent_vector::copy_array
static void __TBB_EXPORTED_FUNC copy_array(void *dst, const void *src, size_type n)
Copy-construct n instances of T by copying single element pointed to by src, starting at "dst".
Definition: concurrent_vector.h:1300
tbb::internal::concurrent_vector_base_v3::internal_copy
void __TBB_EXPORTED_METHOD internal_copy(const concurrent_vector_base_v3 &src, size_type element_size, internal_array_op2 copy)
Definition: concurrent_vector.cpp:356

References __TBB_CATCH, __TBB_RETHROW, __TBB_TRY, tbb::concurrent_vector< T, A >::copy_array(), tbb::concurrent_vector< T, A >::destroy_array(), tbb::concurrent_vector< T, A >::internal_allocator(), tbb::internal::concurrent_vector_base_v3::internal_clear(), tbb::internal::concurrent_vector_base_v3::internal_copy(), tbb::concurrent_vector< T, A >::internal_free_segments(), tbb::internal::concurrent_vector_base_v3::my_first_block, tbb::internal::concurrent_vector_base_v3::my_segment, tbb::relaxed, and tbb::internal::concurrent_vector_base_v3::vector_allocator_ptr.

Here is the call graph for this function:

## concurrent_vector() [4/9]

template<typename T , class A >

tbb::concurrent_vector< T, A >::concurrent_vector | ( | concurrent_vector< T, A > && | source | ) |

inline

Move constructor.

Definition at line 650 of file concurrent_vector.h.

: internal::allocator_base<T, A>(std::move(source)), internal::concurrent_vector_base()
{
vector_allocator_ptr = &internal_allocator;
concurrent_vector_base_v3::internal_swap(source);
}
tbb::move
void move(tbb_thread &t1, tbb_thread &t2)
Definition: tbb_thread.h:319
tbb::internal::concurrent_vector_base_v3::internal_swap
void __TBB_EXPORTED_METHOD internal_swap(concurrent_vector_base_v3 &v)
Definition: concurrent_vector.cpp:582

References tbb::concurrent_vector< T, A >::internal_allocator(), tbb::internal::concurrent_vector_base_v3::internal_swap(), and tbb::internal::concurrent_vector_base_v3::vector_allocator_ptr.

Here is the call graph for this function:

## concurrent_vector() [5/9]

template<typename T , class A >

tbb::concurrent_vector< T, A >::concurrent_vector | ( | concurrent_vector< T, A > && | source,
|  | const allocator_type & | a
| ) |  |

inline

Definition at line 657 of file concurrent_vector.h.

: internal::allocator_base<T, A>(a), internal::concurrent_vector_base()
{
vector_allocator_ptr = &internal_allocator;
//C++ standard requires instances of an allocator being compared for equality,
//which means that memory allocated by one instance is possible to deallocate with the other one.
if (a == source.my_allocator) {
concurrent_vector_base_v3::internal_swap(source);
} else {
__TBB_TRY {
internal_copy(source, sizeof(T), &move_array);
} __TBB_CATCH(...) {
segment_t *table = my_segment.load<relaxed>();
internal_free_segments( table, internal_clear(&destroy_array), my_first_block.load<relaxed>());
__TBB_RETHROW();
}
}
}
tbb::concurrent_vector::move_array
static void __TBB_EXPORTED_FUNC move_array(void *dst, const void *src, size_type n)
Move-construct n instances of T, starting at "dst" by copying according element of src array.
Definition: concurrent_vector.h:1306

References __TBB_CATCH, __TBB_RETHROW, __TBB_TRY, tbb::concurrent_vector< T, A >::destroy_array(), tbb::concurrent_vector< T, A >::internal_allocator(), tbb::internal::concurrent_vector_base_v3::internal_clear(), tbb::internal::concurrent_vector_base_v3::internal_copy(), tbb::concurrent_vector< T, A >::internal_free_segments(), tbb::internal::concurrent_vector_base_v3::internal_swap(), tbb::concurrent_vector< T, A >::move_array(), tbb::internal::concurrent_vector_base_v3::my_first_block, tbb::internal::concurrent_vector_base_v3::my_segment, tbb::relaxed, and tbb::internal::concurrent_vector_base_v3::vector_allocator_ptr.

Here is the call graph for this function:

## concurrent_vector() [6/9]

template<typename T , class A >
template<class M >

__TBB_DEPRECATED tbb::concurrent_vector< T, A >::concurrent_vector | ( | const concurrent_vector< T, M > & | vector,
|  | const allocator_type & | a = `allocator_type()`
| ) |  |

inline

Copying constructor for vector with different allocator type.

Definition at line 680 of file concurrent_vector.h.

: internal::allocator_base<T, A>(a), internal::concurrent_vector_base()
{
vector_allocator_ptr = &internal_allocator;
__TBB_TRY {
internal_copy(vector.internal_vector_base(), sizeof(T), &copy_array);
} __TBB_CATCH(...) {
segment_t *table = my_segment.load<relaxed>();
internal_free_segments( table, internal_clear(&destroy_array), my_first_block.load<relaxed>() );
__TBB_RETHROW();
}
}

References __TBB_CATCH, __TBB_RETHROW, __TBB_TRY, tbb::concurrent_vector< T, A >::copy_array(), tbb::concurrent_vector< T, A >::destroy_array(), tbb::concurrent_vector< T, A >::internal_allocator(), tbb::internal::concurrent_vector_base_v3::internal_clear(), tbb::internal::concurrent_vector_base_v3::internal_copy(), tbb::concurrent_vector< T, A >::internal_free_segments(), tbb::concurrent_vector< T, A >::internal_vector_base(), tbb::internal::concurrent_vector_base_v3::my_first_block, tbb::internal::concurrent_vector_base_v3::my_segment, tbb::relaxed, and tbb::internal::concurrent_vector_base_v3::vector_allocator_ptr.

Here is the call graph for this function:

## concurrent_vector() [7/9]

template<typename T , class A >

tbb::concurrent_vector< T, A >::concurrent_vector | ( | size_type | n | ) |

inline explicit

Construction with initial size specified by argument n.

Definition at line 694 of file concurrent_vector.h.

{
vector_allocator_ptr = &internal_allocator;
__TBB_TRY {
internal_resize( n, sizeof(T), max_size(), NULL, &destroy_array, &initialize_array );
} __TBB_CATCH(...) {
segment_t *table = my_segment.load<relaxed>();
internal_free_segments( table, internal_clear(&destroy_array), my_first_block.load<relaxed>() );
__TBB_RETHROW();
}
}
tbb::concurrent_vector::initialize_array
static void __TBB_EXPORTED_FUNC initialize_array(void *begin, const void *, size_type n)
Construct n instances of T, starting at "begin".
Definition: concurrent_vector.h:1290
tbb::concurrent_vector::max_size
size_type max_size() const
Upper bound on argument to reserve.
Definition: concurrent_vector.h:933
tbb::internal::concurrent_vector_base_v3::internal_resize
void __TBB_EXPORTED_METHOD internal_resize(size_type n, size_type element_size, size_type max_size, const void *src, internal_array_op1 destroy, internal_array_op2 init)
Definition: concurrent_vector.cpp:486

References __TBB_CATCH, __TBB_RETHROW, __TBB_TRY, tbb::concurrent_vector< T, A >::destroy_array(), tbb::concurrent_vector< T, A >::initialize_array(), tbb::concurrent_vector< T, A >::internal_allocator(), tbb::internal::concurrent_vector_base_v3::internal_clear(), tbb::concurrent_vector< T, A >::internal_free_segments(), tbb::internal::concurrent_vector_base_v3::internal_resize(), tbb::concurrent_vector< T, A >::max_size(), tbb::internal::concurrent_vector_base_v3::my_first_block, tbb::internal::concurrent_vector_base_v3::my_segment, tbb::relaxed, and tbb::internal::concurrent_vector_base_v3::vector_allocator_ptr.

Here is the call graph for this function:

## concurrent_vector() [8/9]

template<typename T , class A >

tbb::concurrent_vector< T, A >::concurrent_vector | ( | size_type | n,
|  | const_reference | t,
|  | const allocator_type & | a = `allocator_type()`
| ) |  |

inline

Construction with initial size specified by argument n, initialization by copying of t, and given allocator instance.

Definition at line 707 of file concurrent_vector.h.

: internal::allocator_base<T, A>(a)
{
vector_allocator_ptr = &internal_allocator;
__TBB_TRY {
internal_resize( n, sizeof(T), max_size(), static_cast<const void*>(&t), &destroy_array, &initialize_array_by );
} __TBB_CATCH(...) {
segment_t *table = my_segment.load<relaxed>();
internal_free_segments( table, internal_clear(&destroy_array), my_first_block.load<relaxed>() );
__TBB_RETHROW();
}
}
tbb::concurrent_vector::initialize_array_by
static void __TBB_EXPORTED_FUNC initialize_array_by(void *begin, const void *src, size_type n)
Copy-construct n instances of T, starting at "begin".
Definition: concurrent_vector.h:1295

References __TBB_CATCH, __TBB_RETHROW, __TBB_TRY, tbb::concurrent_vector< T, A >::destroy_array(), tbb::concurrent_vector< T, A >::initialize_array_by(), tbb::concurrent_vector< T, A >::internal_allocator(), tbb::internal::concurrent_vector_base_v3::internal_clear(), tbb::concurrent_vector< T, A >::internal_free_segments(), tbb::internal::concurrent_vector_base_v3::internal_resize(), tbb::concurrent_vector< T, A >::max_size(), tbb::internal::concurrent_vector_base_v3::my_first_block, tbb::internal::concurrent_vector_base_v3::my_segment, tbb::relaxed, and tbb::internal::concurrent_vector_base_v3::vector_allocator_ptr.

Here is the call graph for this function:

## concurrent_vector() [9/9]

template<typename T , class A >
template<class I >

tbb::concurrent_vector< T, A >::concurrent_vector | ( | I | first,
|  | I | last,
|  | const allocator_type & | a = `allocator_type()`
| ) |  |

inline

Construction with copying iteration range and given allocator instance.

Definition at line 722 of file concurrent_vector.h.

: internal::allocator_base<T, A>(a)
{
vector_allocator_ptr = &internal_allocator;
__TBB_TRY {
internal_assign_range(first, last, static_cast<is_integer_tag<std::numeric_limits<I>::is_integer> *>(0) );
} __TBB_CATCH(...) {
segment_t *table = my_segment.load<relaxed>();
internal_free_segments( table, internal_clear(&destroy_array), my_first_block.load<relaxed>() );
__TBB_RETHROW();
}
}
tbb::internal::last
auto last(Container &c) -> decltype(begin(c))
Definition: _range_iterator.h:40
tbb::internal::first
auto first(Container &c) -> decltype(begin(c))
Definition: _range_iterator.h:34
tbb::concurrent_vector::internal_assign_range
void internal_assign_range(I first, I last, is_integer_tag< true > *)
assign integer items by copying when arguments are treated as iterators. See C++ Standard 2003 23....
Definition: concurrent_vector.h:1060

References __TBB_CATCH, __TBB_RETHROW, __TBB_TRY, tbb::concurrent_vector< T, A >::destroy_array(), tbb::internal::first(), tbb::concurrent_vector< T, A >::internal_allocator(), tbb::concurrent_vector< T, A >::internal_assign_range(), tbb::internal::concurrent_vector_base_v3::internal_clear(), tbb::concurrent_vector< T, A >::internal_free_segments(), tbb::internal::last(), tbb::internal::concurrent_vector_base_v3::my_first_block, tbb::internal::concurrent_vector_base_v3::my_segment, tbb::relaxed, and tbb::internal::concurrent_vector_base_v3::vector_allocator_ptr.

Here is the call graph for this function:

## ~concurrent_vector()

template<typename T , class A >

tbb::concurrent_vector< T, A >::~concurrent_vector | ( |  | ) |

inline

Clear and destroy vector.

Definition at line 1023 of file concurrent_vector.h.

{
segment_t *table = my_segment.load<relaxed>();
internal_free_segments( table, internal_clear(&destroy_array), my_first_block.load<relaxed>() );
// base class destructor call should be then
}

References tbb::concurrent_vector< T, A >::destroy_array(), tbb::internal::concurrent_vector_base_v3::internal_clear(), tbb::concurrent_vector< T, A >::internal_free_segments(), tbb::internal::concurrent_vector_base_v3::my_first_block, tbb::internal::concurrent_vector_base_v3::my_segment, and tbb::relaxed.

Here is the call graph for this function:

## Member Function Documentation

## assign() [1/3]

template<typename T , class A >
template<class I >

void tbb::concurrent_vector< T, A >::assign | ( | I | first,
|  | I | last
| ) |  |

inline

assign range [first, last)

Definition at line 996 of file concurrent_vector.h.

{
clear(); internal_assign_range( first, last, static_cast<is_integer_tag<std::numeric_limits<I>::is_integer> *>(0) );
}
tbb::concurrent_vector::clear
void clear()
Clear container while keeping memory allocated.
Definition: concurrent_vector.h:1018

References tbb::concurrent_vector< T, A >::clear(), tbb::internal::first(), tbb::concurrent_vector< T, A >::internal_assign_range(), and tbb::internal::last().

Here is the call graph for this function:

## assign() [2/3]

template<typename T , class A >

void tbb::concurrent_vector< T, A >::assign | ( | size_type | n,
|  | const_reference | t
| ) |  |

inline

assign n items by copying t item

Definition at line 989 of file concurrent_vector.h.

{
clear();
internal_resize( n, sizeof(T), max_size(), static_cast<const void*>(&t), &destroy_array, &initialize_array_by );
}

References tbb::concurrent_vector< T, A >::clear(), tbb::concurrent_vector< T, A >::destroy_array(), tbb::concurrent_vector< T, A >::initialize_array_by(), tbb::internal::concurrent_vector_base_v3::internal_resize(), and tbb::concurrent_vector< T, A >::max_size().

Here is the call graph for this function:

## assign() [3/3]

template<typename T , class A >

void tbb::concurrent_vector< T, A >::assign | ( | std::initializer_list< T > | init_list | ) |

inline

assigns an initializer list

Definition at line 1002 of file concurrent_vector.h.

{
clear(); internal_assign_iterators( init_list.begin(), init_list.end());
}

References tbb::concurrent_vector< T, A >::clear(), and tbb::concurrent_vector< T, A >::internal_assign_iterators().

Here is the call graph for this function:

## assign_array()

template<typename T , class A >

void tbb::concurrent_vector< T, A >::assign_array | ( | void * | dst,
|  | const void * | src,
|  | size_type | n
| ) |  |

static private

Assign (using operator=) n instances of T, starting at "dst" by assigning according element of src array.

Definition at line 1330 of file concurrent_vector.h.

{
internal_loop_guide loop(n, dst); loop.assign(src);
}

References tbb::concurrent_vector< T, A >::internal_loop_guide::assign().

Referenced by tbb::concurrent_vector< T, A >::operator=().

Here is the call graph for this function:
Here is the caller graph for this function:

## at() [1/2]

template<typename T , class A >

reference tbb::concurrent_vector< T, A >::at | ( | size_type | index | ) |

inline

Get reference to element at given index. Throws exceptions on errors.

Definition at line 877 of file concurrent_vector.h.

{
return internal_subscript_with_exceptions(index);
}
tbb::concurrent_vector::internal_subscript_with_exceptions
T & internal_subscript_with_exceptions(size_type index) const
Get reference to element at given index with errors checks.
Definition: concurrent_vector.h:1251

References tbb::concurrent_vector< T, A >::internal_subscript_with_exceptions().

Here is the call graph for this function:

## at() [2/2]

template<typename T , class A >

const_reference tbb::concurrent_vector< T, A >::at | ( | size_type | index | ) | const

inline

Get const reference to element at given index. Throws exceptions on errors.

Definition at line 882 of file concurrent_vector.h.

{
return internal_subscript_with_exceptions(index);
}

References tbb::concurrent_vector< T, A >::internal_subscript_with_exceptions().

Here is the call graph for this function:

## back() [1/2]

template<typename T , class A >

reference tbb::concurrent_vector< T, A >::back | ( |  | ) |

inline

the last item

Definition at line 976 of file concurrent_vector.h.

{
__TBB_ASSERT( size()>0, NULL);
return internal_subscript( size()-1 );
}
__TBB_ASSERT
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
tbb::concurrent_vector::size
size_type size() const
Return size of vector. It may include elements under construction.
Definition: concurrent_vector.h:900
tbb::concurrent_vector::internal_subscript
T & internal_subscript(size_type index) const
Get reference to element at given index.
Definition: concurrent_vector.h:1234

References __TBB_ASSERT, tbb::concurrent_vector< T, A >::internal_subscript(), and tbb::concurrent_vector< T, A >::size().

Here is the call graph for this function:

## back() [2/2]

template<typename T , class A >

const_reference tbb::concurrent_vector< T, A >::back | ( |  | ) | const

inline

the last item const

Definition at line 981 of file concurrent_vector.h.

{
__TBB_ASSERT( size()>0, NULL);
return internal_subscript( size()-1 );
}

References __TBB_ASSERT, tbb::concurrent_vector< T, A >::internal_subscript(), and tbb::concurrent_vector< T, A >::size().

Here is the call graph for this function:

## begin() [1/2]

template<typename T , class A >

iterator tbb::concurrent_vector< T, A >::begin | ( |  | ) |

inline

start iterator

Definition at line 940 of file concurrent_vector.h.

{return iterator(*this,0);}
tbb::concurrent_vector::iterator
internal::vector_iterator< concurrent_vector, T > iterator
Definition: concurrent_vector.h:584

Referenced by tbb::concurrent_vector< T, A >::crend(), tbb::operator<(), tbb::operator==(), tbb::concurrent_vector< T, A >::range(), and tbb::concurrent_vector< T, A >::rend().

Here is the caller graph for this function:

## begin() [2/2]

template<typename T , class A >

const_iterator tbb::concurrent_vector< T, A >::begin | ( |  | ) | const

inline

start const iterator

Definition at line 944 of file concurrent_vector.h.

{return const_iterator(*this,0);}
tbb::concurrent_vector::const_iterator
internal::vector_iterator< concurrent_vector, const T > const_iterator
Definition: concurrent_vector.h:585

## capacity()

template<typename T , class A >

size_type tbb::concurrent_vector< T, A >::capacity | ( |  | ) | const

inline

Maximum size to which array can grow without allocating more memory. Concurrent allocations are not included in the value.

Definition at line 909 of file concurrent_vector.h.

{return internal_capacity();}
tbb::internal::concurrent_vector_base_v3::internal_capacity
size_type __TBB_EXPORTED_METHOD internal_capacity() const
Definition: concurrent_vector.cpp:329

References tbb::internal::concurrent_vector_base_v3::internal_capacity().

Here is the call graph for this function:

## cbegin()

template<typename T , class A >

const_iterator tbb::concurrent_vector< T, A >::cbegin | ( |  | ) | const

inline

start const iterator

Definition at line 948 of file concurrent_vector.h.

{return const_iterator(*this,0);}

## cend()

template<typename T , class A >

const_iterator tbb::concurrent_vector< T, A >::cend | ( |  | ) | const

inline

end const iterator

Definition at line 950 of file concurrent_vector.h.

{return const_iterator(*this,size());}

References tbb::concurrent_vector< T, A >::size().

Here is the call graph for this function:

## clear()

template<typename T , class A >

void tbb::concurrent_vector< T, A >::clear | ( |  | ) |

inline

Clear container while keeping memory allocated.

To free up the memory, use in conjunction with method compact(). Not thread safe

Definition at line 1018 of file concurrent_vector.h.

{
internal_clear(&destroy_array);
}

References tbb::concurrent_vector< T, A >::destroy_array(), and tbb::internal::concurrent_vector_base_v3::internal_clear().

Referenced by tbb::concurrent_vector< T, A >::assign(), and tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::clear().

Here is the call graph for this function:
Here is the caller graph for this function:

## copy_array()

template<typename T , class A >

void tbb::concurrent_vector< T, A >::copy_array | ( | void * | dst,
|  | const void * | src,
|  | size_type | n
| ) |  |

static private

Copy-construct n instances of T by copying single element pointed to by src, starting at "dst".

Definition at line 1300 of file concurrent_vector.h.

{
internal_loop_guide loop(n, dst); loop.copy(src);
}

References tbb::concurrent_vector< T, A >::internal_loop_guide::copy().

Referenced by tbb::concurrent_vector< T, A >::concurrent_vector(), and tbb::concurrent_vector< T, A >::operator=().

Here is the call graph for this function:
Here is the caller graph for this function:

## copy_range() [1/2]

template<typename T , class A >
template<typename Iterator >

static void __TBB_EXPORTED_FUNC tbb::concurrent_vector< T, A >::copy_range | ( | void * | dst,
|  | const void * | p_type_erased_iterator,
|  | size_type | n
| ) |  |

static private

Copy-construct n instances of T, starting at "dst" by iterator range of [p_type_erased_iterator, p_type_erased_iterator+n).

## copy_range() [2/2]

template<typename T , class A >
template<typename I >

void tbb::concurrent_vector< T, A >::copy_range | ( | void * | dst,
|  | const void * | p_type_erased_iterator,
|  | size_type | n
| ) |  |

Definition at line 1324 of file concurrent_vector.h.

{
internal_loop_guide loop(n, dst);
loop.iterate( *(static_cast<I*>(const_cast<void*>(p_type_erased_iterator))) );
}

References tbb::concurrent_vector< T, A >::internal_loop_guide::iterate().

Here is the call graph for this function:

## crbegin()

template<typename T , class A >

const_reverse_iterator tbb::concurrent_vector< T, A >::crbegin | ( |  | ) | const

inline

reverse start const iterator

Definition at line 960 of file concurrent_vector.h.

{return const_reverse_iterator(end());}
tbb::concurrent_vector::end
iterator end()
end iterator
Definition: concurrent_vector.h:942
tbb::concurrent_vector::const_reverse_iterator
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: concurrent_vector.h:590

References tbb::concurrent_vector< T, A >::end().

Here is the call graph for this function:

## crend()

template<typename T , class A >

const_reverse_iterator tbb::concurrent_vector< T, A >::crend | ( |  | ) | const

inline

reverse end const iterator

Definition at line 962 of file concurrent_vector.h.

{return const_reverse_iterator(begin());}
tbb::concurrent_vector::begin
iterator begin()
start iterator
Definition: concurrent_vector.h:940

References tbb::concurrent_vector< T, A >::begin().

Here is the call graph for this function:

## destroy_array()

template<typename T , class A >

void tbb::concurrent_vector< T, A >::destroy_array | ( | void * | begin,
|  | size_type | n
| ) |  |

static private

Destroy n instances of T, starting at "begin".

Definition at line 1340 of file concurrent_vector.h.

{
T* array = static_cast<T*>(begin);
for( size_type j=n; j>0; --j )
array[j-1].~T(); // destructors are supposed to not throw any exceptions
}
tbb::concurrent_vector::size_type
internal::concurrent_vector_base_v3::size_type size_type
Definition: concurrent_vector.h:574

References begin.

Referenced by tbb::concurrent_vector< T, A >::assign(), tbb::concurrent_vector< T, A >::clear(), tbb::concurrent_vector< T, A >::concurrent_vector(), tbb::concurrent_vector< T, A >::internal_assign_n(), tbb::concurrent_vector< T, A >::operator=(), tbb::concurrent_vector< T, A >::resize(), and tbb::concurrent_vector< T, A >::~concurrent_vector().

Here is the caller graph for this function:

## emplace_back()

template<typename T , class A >
template<typename... Args>

iterator tbb::concurrent_vector< T, A >::emplace_back | ( | Args &&... | args | ) |

inline

Push item, create item "in place" with provided arguments.

Returns iterator pointing to the new element.

Definition at line 856 of file concurrent_vector.h.

{
push_back_helper prolog(*this);
new(prolog.internal_push_back_result()) T(std::forward<Args>(args)...);
return prolog.return_iterator_and_dismiss();
}

References tbb::concurrent_vector< T, A >::push_back_helper::internal_push_back_result(), and tbb::concurrent_vector< T, A >::push_back_helper::return_iterator_and_dismiss().

Here is the call graph for this function:

## empty()

template<typename T , class A >

bool tbb::concurrent_vector< T, A >::empty | ( |  | ) | const

inline

Return false if vector is not empty or has elements under construction at least.

Definition at line 906 of file concurrent_vector.h.

{return !my_early_size;}
tbb::internal::concurrent_vector_base_v3::my_early_size
atomic< size_type > my_early_size
Requested size of vector.
Definition: concurrent_vector.h:184

References tbb::internal::concurrent_vector_base_v3::my_early_size.

Referenced by tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::empty().

Here is the caller graph for this function:

## end() [1/2]

template<typename T , class A >

iterator tbb::concurrent_vector< T, A >::end | ( |  | ) |

inline

end iterator

Definition at line 942 of file concurrent_vector.h.

{return iterator(*this,size());}

References tbb::concurrent_vector< T, A >::size().

Referenced by tbb::concurrent_vector< T, A >::crbegin(), tbb::operator<(), tbb::operator==(), tbb::concurrent_vector< T, A >::range(), and tbb::concurrent_vector< T, A >::rbegin().

Here is the call graph for this function:
Here is the caller graph for this function:

## end() [2/2]

template<typename T , class A >

const_iterator tbb::concurrent_vector< T, A >::end | ( |  | ) | const

inline

end const iterator

Definition at line 946 of file concurrent_vector.h.

{return const_iterator(*this,size());}

References tbb::concurrent_vector< T, A >::size().

Here is the call graph for this function:

## front() [1/2]

template<typename T , class A >

reference tbb::concurrent_vector< T, A >::front | ( |  | ) |

inline

the first item

Definition at line 964 of file concurrent_vector.h.

{
__TBB_ASSERT( size()>0, NULL);
const segment_value_t& segment_value = my_segment[0].template load<relaxed>();
return (segment_value.template pointer<T>())[0];
}

References __TBB_ASSERT, tbb::internal::concurrent_vector_base_v3::my_segment, and tbb::concurrent_vector< T, A >::size().

Here is the call graph for this function:

## front() [2/2]

template<typename T , class A >

const_reference tbb::concurrent_vector< T, A >::front | ( |  | ) | const

inline

the first item const

Definition at line 970 of file concurrent_vector.h.

{
__TBB_ASSERT( size()>0, NULL);
const segment_value_t& segment_value = my_segment[0].template load<relaxed>();
return (segment_value.template pointer<const T>())[0];
}

References __TBB_ASSERT, tbb::internal::concurrent_vector_base_v3::my_segment, and tbb::concurrent_vector< T, A >::size().

Here is the call graph for this function:

## get_allocator()

template<typename T , class A >

allocator_type tbb::concurrent_vector< T, A >::get_allocator | ( |  | ) | const

inline

return allocator object

Definition at line 986 of file concurrent_vector.h.

{ return this->my_allocator; }
tbb::internal::allocator_base::my_allocator
allocator_type my_allocator
Definition: concurrent_vector.h:480

References tbb::internal::allocator_base< T, A >::my_allocator.

## grow_by() [1/4]

template<typename T , class A >
template<typename I >

iterator tbb::concurrent_vector< T, A >::grow_by | ( | I | first,
|  | I | last
| ) |  |

inline

Returns iterator pointing to the first new element.

Definition at line 795 of file concurrent_vector.h.

{
typename std::iterator_traits<I>::difference_type delta = std::distance(first, last);
__TBB_ASSERT( delta >= 0, NULL);
return iterator(*this, delta ? internal_grow_by(delta, sizeof(T), &copy_range<I>, static_cast<const void*>(&first)) : my_early_size.load());
}
tbb::internal::concurrent_vector_base_v3::internal_grow_by
size_type __TBB_EXPORTED_METHOD internal_grow_by(size_type delta, size_type element_size, internal_array_op2 init, const void *src)
Definition: concurrent_vector.cpp:467

References __TBB_ASSERT, tbb::internal::first(), tbb::internal::concurrent_vector_base_v3::internal_grow_by(), tbb::internal::last(), and tbb::internal::concurrent_vector_base_v3::my_early_size.

Here is the call graph for this function:

## grow_by() [2/4]

template<typename T , class A >

iterator tbb::concurrent_vector< T, A >::grow_by | ( | size_type | delta | ) |

inline

Grow by "delta" elements.

Returns iterator pointing to the first new element.

Definition at line 783 of file concurrent_vector.h.

{
return iterator(*this, delta ? internal_grow_by( delta, sizeof(T), &initialize_array, NULL ) : my_early_size.load());
}

References tbb::concurrent_vector< T, A >::initialize_array(), tbb::internal::concurrent_vector_base_v3::internal_grow_by(), and tbb::internal::concurrent_vector_base_v3::my_early_size.

Referenced by tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::create_local(), tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::create_local_by_copy(), tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::create_local_by_move(), and tbb::concurrent_vector< T, A >::grow_by().

Here is the call graph for this function:
Here is the caller graph for this function:

## grow_by() [3/4]

template<typename T , class A >

iterator tbb::concurrent_vector< T, A >::grow_by | ( | size_type | delta,
|  | const_reference | t
| ) |  |

inline

Grow by "delta" elements using copying constructor.

Returns iterator pointing to the first new element.

Definition at line 789 of file concurrent_vector.h.

{
return iterator(*this, delta ? internal_grow_by( delta, sizeof(T), &initialize_array_by, static_cast<const void*>(&t) ) : my_early_size.load());
}

References tbb::concurrent_vector< T, A >::initialize_array_by(), tbb::internal::concurrent_vector_base_v3::internal_grow_by(), and tbb::internal::concurrent_vector_base_v3::my_early_size.

Here is the call graph for this function:

## grow_by() [4/4]

template<typename T , class A >

iterator tbb::concurrent_vector< T, A >::grow_by | ( | std::initializer_list< T > | init_list | ) |

inline

Returns iterator pointing to the first new element.

Definition at line 804 of file concurrent_vector.h.

{
return grow_by( init_list.begin(), init_list.end() );
}
tbb::concurrent_vector::grow_by
iterator grow_by(size_type delta)
Grow by "delta" elements.
Definition: concurrent_vector.h:783

References tbb::concurrent_vector< T, A >::grow_by().

Here is the call graph for this function:

## grow_to_at_least() [1/2]

template<typename T , class A >

iterator tbb::concurrent_vector< T, A >::grow_to_at_least | ( | size_type | n | ) |

inline

Append minimal sequence of elements such that size()>=n.

The new elements are default constructed. Blocks until all elements in range [0..n) are allocated. May return while other elements are being constructed by other threads. Returns iterator that points to beginning of appended sequence. If no elements were appended, returns iterator pointing to nth element.

Definition at line 814 of file concurrent_vector.h.

{
size_type m=0;
if( n ) {
m = internal_grow_to_at_least_with_result( n, sizeof(T), &initialize_array, NULL );
if( m>n ) m=n;
}
return iterator(*this, m);
};
tbb::internal::concurrent_vector_base_v3::internal_grow_to_at_least_with_result
size_type __TBB_EXPORTED_METHOD internal_grow_to_at_least_with_result(size_type new_size, size_type element_size, internal_array_op2 init, const void *src)
Definition: concurrent_vector.cpp:434

References tbb::concurrent_vector< T, A >::initialize_array(), and tbb::internal::concurrent_vector_base_v3::internal_grow_to_at_least_with_result().

Here is the call graph for this function:

## grow_to_at_least() [2/2]

template<typename T , class A >

iterator tbb::concurrent_vector< T, A >::grow_to_at_least | ( | size_type | n,
|  | const_reference | t
| ) |  |

inline

Analogous to grow_to_at_least( size_type n ) with exception that the new elements are initialized by copying of t instead of default construction.

Definition at line 825 of file concurrent_vector.h.

{
size_type m=0;
if( n ) {
m = internal_grow_to_at_least_with_result( n, sizeof(T), &initialize_array_by, &t);
if( m>n ) m=n;
}
return iterator(*this, m);
};

References tbb::concurrent_vector< T, A >::initialize_array_by(), and tbb::internal::concurrent_vector_base_v3::internal_grow_to_at_least_with_result().

Here is the call graph for this function:

## initialize_array()

template<typename T , class A >

void tbb::concurrent_vector< T, A >::initialize_array | ( | void * | begin,
|  | const void * | ,
|  | size_type | n
| ) |  |

static private

Construct n instances of T, starting at "begin".

Definition at line 1290 of file concurrent_vector.h.

{
internal_loop_guide loop(n, begin); loop.init();
}

References begin, and tbb::concurrent_vector< T, A >::internal_loop_guide::init().

Referenced by tbb::concurrent_vector< T, A >::concurrent_vector(), tbb::concurrent_vector< T, A >::grow_by(), tbb::concurrent_vector< T, A >::grow_to_at_least(), tbb::concurrent_vector< T, A >::internal_assign_n(), and tbb::concurrent_vector< T, A >::resize().

Here is the call graph for this function:
Here is the caller graph for this function:

## initialize_array_by()

template<typename T , class A >

void tbb::concurrent_vector< T, A >::initialize_array_by | ( | void * | begin,
|  | const void * | src,
|  | size_type | n
| ) |  |

static private

Copy-construct n instances of T, starting at "begin".

Definition at line 1295 of file concurrent_vector.h.

{
internal_loop_guide loop(n, begin); loop.init(src);
}

References begin, and tbb::concurrent_vector< T, A >::internal_loop_guide::init().

Referenced by tbb::concurrent_vector< T, A >::assign(), tbb::concurrent_vector< T, A >::concurrent_vector(), tbb::concurrent_vector< T, A >::grow_by(), tbb::concurrent_vector< T, A >::grow_to_at_least(), tbb::concurrent_vector< T, A >::internal_assign_n(), and tbb::concurrent_vector< T, A >::resize().

Here is the call graph for this function:
Here is the caller graph for this function:

## internal_allocator()

template<typename T , class A >

static void* tbb::concurrent_vector< T, A >::internal_allocator | ( | internal::concurrent_vector_base_v3 & | vb,
|  | size_t | k
| ) |  |

inline static private

Allocate k items.

Definition at line 1032 of file concurrent_vector.h.

{
return static_cast<concurrent_vector<T, A>&>(vb).my_allocator.allocate(k);
}

References tbb::internal::allocator_base< T, A >::my_allocator.

Referenced by tbb::concurrent_vector< T, A >::concurrent_vector().

Here is the caller graph for this function:

## internal_assign_iterators()

template<typename T , class A >
template<class I >

void tbb::concurrent_vector< T, A >::internal_assign_iterators | ( | I | first,
|  | I | last
| ) |  |

private

assign by iterators

Definition at line 1269 of file concurrent_vector.h.

{
__TBB_ASSERT(my_early_size == 0, NULL);
size_type n = std::distance(first, last);
if( !n ) return;
internal_reserve(n, sizeof(T), max_size());
my_early_size = n;
segment_index_t k = 0;
//TODO: unify segment iteration code with concurrent_base_v3::helper
size_type sz = segment_size( my_first_block );
while( sz < n ) {
internal_loop_guide loop(sz, my_segment[k].template load<relaxed>().template pointer<void>());
loop.iterate(first);
n -= sz;
if( !k ) k = my_first_block;
else { ++k; sz <<= 1; }
}
internal_loop_guide loop(n, my_segment[k].template load<relaxed>().template pointer<void>());
loop.iterate(first);
}
tbb::internal::concurrent_vector_base_v3::segment_index_t
size_t segment_index_t
Definition: concurrent_vector.h:87
tbb::internal::concurrent_vector_base_v3::segment_size
static size_type segment_size(segment_index_t k)
Definition: concurrent_vector.h:228
tbb::internal::concurrent_vector_base_v3::internal_reserve
void __TBB_EXPORTED_METHOD internal_reserve(size_type n, size_type element_size, size_type max_size)
Definition: concurrent_vector.cpp:339

References __TBB_ASSERT, tbb::internal::first(), tbb::concurrent_vector< T, A >::internal_loop_guide::iterate(), and tbb::internal::last().

Referenced by tbb::concurrent_vector< T, A >::assign(), tbb::concurrent_vector< T, A >::concurrent_vector(), tbb::concurrent_vector< T, A >::internal_assign_range(), and tbb::concurrent_vector< T, A >::operator=().

Here is the call graph for this function:
Here is the caller graph for this function:

## internal_assign_n()

template<typename T , class A >

void tbb::concurrent_vector< T, A >::internal_assign_n | ( | size_type | n,
|  | const_pointer | p
| ) |  |

inline private

assign n items by copying t

Definition at line 1045 of file concurrent_vector.h.

{
internal_resize( n, sizeof(T), max_size(), static_cast<const void*>(p), &destroy_array, p? &initialize_array_by : &initialize_array );
}
p
void const char const char int ITT_FORMAT __itt_group_sync p
Definition: ittnotify_static.h:91

References tbb::concurrent_vector< T, A >::destroy_array(), tbb::concurrent_vector< T, A >::initialize_array(), tbb::concurrent_vector< T, A >::initialize_array_by(), tbb::internal::concurrent_vector_base_v3::internal_resize(), tbb::concurrent_vector< T, A >::max_size(), and p.

Referenced by tbb::concurrent_vector< T, A >::internal_assign_range().

Here is the call graph for this function:
Here is the caller graph for this function:

## internal_assign_range() [1/2]

template<typename T , class A >
template<class I >

void tbb::concurrent_vector< T, A >::internal_assign_range | ( | I | first,
|  | I | last,
|  | is_integer_tag< false > * |
| ) |  |

inline private

inline proxy assign by iterators

Definition at line 1065 of file concurrent_vector.h.

{
internal_assign_iterators(first, last);
}

References tbb::internal::first(), tbb::concurrent_vector< T, A >::internal_assign_iterators(), and tbb::internal::last().

Here is the call graph for this function:

## internal_assign_range() [2/2]

template<typename T , class A >
template<class I >

void tbb::concurrent_vector< T, A >::internal_assign_range | ( | I | first,
|  | I | last,
|  | is_integer_tag< true > * |
| ) |  |

inline private

assign integer items by copying when arguments are treated as iterators. See C++ Standard 2003 23.1.1p9

Definition at line 1060 of file concurrent_vector.h.

{
internal_assign_n(static_cast<size_type>(first), &static_cast<T&>(last));
}
tbb::concurrent_vector::internal_assign_n
void internal_assign_n(size_type n, const_pointer p)
assign n items by copying t
Definition: concurrent_vector.h:1045

References tbb::internal::first(), tbb::concurrent_vector< T, A >::internal_assign_n(), and tbb::internal::last().

Referenced by tbb::concurrent_vector< T, A >::assign(), and tbb::concurrent_vector< T, A >::concurrent_vector().

Here is the call graph for this function:
Here is the caller graph for this function:

## internal_free_segments()

template<typename T , class A >

void tbb::concurrent_vector< T, A >::internal_free_segments | ( | segment_t | table[],
|  | segment_index_t | k,
|  | segment_index_t | first_block
| ) |  |

private

Free k segments from table.

Definition at line 1216 of file concurrent_vector.h.

{
// Free the arrays
while( k > first_block ) {
--k;
segment_value_t segment_value = table[k].load<relaxed>();
table[k].store<relaxed>(segment_not_used());
if( segment_value == segment_allocated() ) // check for correct segment pointer
this->my_allocator.deallocate( (segment_value.pointer<T>()), segment_size(k) );
}
segment_value_t segment_value = table[0].load<relaxed>();
if( segment_value == segment_allocated() ) {
__TBB_ASSERT( first_block > 0, NULL );
while(k > 0) table[--k].store<relaxed>(segment_not_used());
this->my_allocator.deallocate( (segment_value.pointer<T>()), segment_size(first_block) );
}
}

References __TBB_ASSERT, tbb::internal::concurrent_vector_base_v3::segment_t::load(), tbb::internal::concurrent_vector_base_v3::segment_value_t::pointer(), tbb::relaxed, and tbb::internal::concurrent_vector_base_v3::segment_t::store().

Referenced by tbb::concurrent_vector< T, A >::concurrent_vector(), and tbb::concurrent_vector< T, A >::~concurrent_vector().

Here is the call graph for this function:
Here is the caller graph for this function:

## internal_subscript()

template<typename T , class A >

T & tbb::concurrent_vector< T, A >::internal_subscript | ( | size_type | index | ) | const

private

Get reference to element at given index.

Definition at line 1234 of file concurrent_vector.h.

{
//TODO: unify both versions of internal_subscript
__TBB_ASSERT( index < my_early_size, "index out of bounds" );
size_type j = index;
segment_index_t k = segment_base_index_of( j );
__TBB_ASSERT( my_segment.load<acquire>() != my_storage || k < pointers_per_short_table, "index is being allocated" );
//no need in load with acquire (load<acquire>) since thread works in own space or gets
//the information about added elements via some form of external synchronization
//TODO: why not make a load of my_segment relaxed as well ?
//TODO: add an assertion that my_segment[k] is properly aligned to please ITT
segment_value_t segment_value = my_segment[k].template load<relaxed>();
__TBB_ASSERT( segment_value != segment_allocation_failed(), "the instance is broken by bad allocation. Use at() instead" );
__TBB_ASSERT( segment_value != segment_not_used(), "index is being allocated" );
return (( segment_value.pointer<T>()))[j];
}
tbb::acquire
@ acquire
Acquire.
Definition: atomic.h:57
tbb::internal::concurrent_vector_base_v3::pointers_per_short_table
@ pointers_per_short_table
Number of slots for segment pointers inside the class.
Definition: concurrent_vector.h:95
tbb::internal::concurrent_vector_base_v3::segment_base_index_of
static segment_index_t segment_base_index_of(segment_index_t &index)
Definition: concurrent_vector.h:222
tbb::internal::concurrent_vector_base_v3::my_storage
segment_t my_storage[pointers_per_short_table]
embedded storage of segment pointers
Definition: concurrent_vector.h:190

References __TBB_ASSERT, tbb::acquire, and tbb::internal::concurrent_vector_base_v3::segment_value_t::pointer().

Referenced by tbb::concurrent_vector< T, A >::back(), and tbb::concurrent_vector< T, A >::operator[]().

Here is the call graph for this function:
Here is the caller graph for this function:

## internal_subscript_with_exceptions()

template<typename T , class A >

T & tbb::concurrent_vector< T, A >::internal_subscript_with_exceptions | ( | size_type | index | ) | const

private

Get reference to element at given index with errors checks.

Definition at line 1251 of file concurrent_vector.h.

{
if( index >= my_early_size )
internal::throw_exception(internal::eid_out_of_range); // throw std::out_of_range
size_type j = index;
segment_index_t k = segment_base_index_of( j );
//TODO: refactor this condition into separate helper function, e.g. fits_into_small_table
if( my_segment.load<acquire>() == my_storage && k >= pointers_per_short_table )
internal::throw_exception(internal::eid_segment_range_error); // throw std::range_error
// no need in load with acquire (load<acquire>) since thread works in own space or gets
//the information about added elements via some form of external synchronization
//TODO: why not make a load of my_segment relaxed as well ?
//TODO: add an assertion that my_segment[k] is properly aligned to please ITT
segment_value_t segment_value = my_segment[k].template load<relaxed>();
enforce_segment_allocated(segment_value, internal::eid_index_range_error);
return (segment_value.pointer<T>())[j];
}
tbb::internal::throw_exception
void throw_exception(exception_id eid)
Versionless convenience wrapper for throw_exception_v4()
Definition: tbb_exception.h:105
tbb::internal::eid_segment_range_error
@ eid_segment_range_error
Definition: tbb_exception.h:72
tbb::internal::eid_out_of_range
@ eid_out_of_range
Definition: tbb_exception.h:71
tbb::internal::eid_index_range_error
@ eid_index_range_error
Definition: tbb_exception.h:73
tbb::internal::concurrent_vector_base_v3::enforce_segment_allocated
friend void enforce_segment_allocated(segment_value_t const &s, internal::exception_id exception=eid_bad_last_alloc)
Definition: concurrent_vector.h:121

References tbb::acquire, tbb::internal::eid_index_range_error, tbb::internal::eid_out_of_range, tbb::internal::eid_segment_range_error, tbb::internal::concurrent_vector_base_v3::segment_value_t::pointer(), and tbb::internal::throw_exception().

Referenced by tbb::concurrent_vector< T, A >::at().

Here is the call graph for this function:
Here is the caller graph for this function:

## internal_vector_base()

template<typename T , class A >

const internal::concurrent_vector_base_v3& tbb::concurrent_vector< T, A >::internal_vector_base | ( |  | ) | const

inline

Definition at line 1029 of file concurrent_vector.h.

{ return *this; }

Referenced by tbb::concurrent_vector< T, A >::concurrent_vector(), and tbb::concurrent_vector< T, A >::operator=().

Here is the caller graph for this function:

## max_size()

template<typename T , class A >

size_type tbb::concurrent_vector< T, A >::max_size | ( |  | ) | const

inline

Upper bound on argument to reserve.

Definition at line 933 of file concurrent_vector.h.

{return (~size_type(0))/sizeof(T);}

Referenced by tbb::concurrent_vector< T, A >::assign(), tbb::concurrent_vector< T, A >::concurrent_vector(), tbb::concurrent_vector< T, A >::internal_assign_n(), tbb::concurrent_vector< T, A >::reserve(), and tbb::concurrent_vector< T, A >::resize().

Here is the caller graph for this function:

## move_array()

template<typename T , class A >

void tbb::concurrent_vector< T, A >::move_array | ( | void * | dst,
|  | const void * | src,
|  | size_type | n
| ) |  |

static private

Move-construct n instances of T, starting at "dst" by copying according element of src array.

Definition at line 1306 of file concurrent_vector.h.

{
internal_loop_guide loop(n, dst); loop.move_construct(src);
}

References tbb::concurrent_vector< T, A >::internal_loop_guide::move_construct().

Referenced by tbb::concurrent_vector< T, A >::concurrent_vector(), and tbb::concurrent_vector< T, A >::operator=().

Here is the call graph for this function:
Here is the caller graph for this function:

## move_assign_array()

template<typename T , class A >

void tbb::concurrent_vector< T, A >::move_assign_array | ( | void * | dst,
|  | const void * | src,
|  | size_type | n
| ) |  |

static private

Move-assign (using operator=) n instances of T, starting at "dst" by assigning according element of src array.

Definition at line 1310 of file concurrent_vector.h.

{
internal_loop_guide loop(n, dst); loop.move_assign(src);
}

References tbb::concurrent_vector< T, A >::internal_loop_guide::move_assign().

Referenced by tbb::concurrent_vector< T, A >::operator=().

Here is the call graph for this function:
Here is the caller graph for this function:

## operator=() [1/4]

template<typename T , class A >

concurrent_vector& tbb::concurrent_vector< T, A >::operator= | ( | concurrent_vector< T, A > && | other | ) |

inline

Move assignment.

Definition at line 745 of file concurrent_vector.h.

{
__TBB_ASSERT(this != &other, "Move assignment to itself is prohibited ");
typedef typename tbb::internal::allocator_traits<A>::propagate_on_container_move_assignment pocma_t;
if(pocma_t::value || this->my_allocator == other.my_allocator) {
concurrent_vector trash (std::move(*this));
internal_swap(other);
tbb::internal::allocator_move_assignment(this->my_allocator, other.my_allocator, pocma_t());
} else {
internal_assign(other, sizeof(T), &destroy_array, &move_assign_array, &move_array);
}
return *this;
}
value
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long value
Definition: ittnotify_static.h:192
tbb::internal::allocator_move_assignment
void allocator_move_assignment(MyAlloc &my_allocator, OtherAlloc &other_allocator, traits_true_type)
Definition: _allocator_traits.h:59
tbb::concurrent_vector::concurrent_vector
concurrent_vector(const allocator_type &a=allocator_type())
Construct empty vector.
Definition: concurrent_vector.h:608
tbb::concurrent_vector::move_assign_array
static void __TBB_EXPORTED_FUNC move_assign_array(void *dst, const void *src, size_type n)
Move-assign (using operator=) n instances of T, starting at "dst" by assigning according element of s...
Definition: concurrent_vector.h:1310
tbb::internal::concurrent_vector_base_v3::internal_assign
void __TBB_EXPORTED_METHOD internal_assign(const concurrent_vector_base_v3 &src, size_type element_size, internal_array_op1 destroy, internal_array_op2 assign, internal_array_op2 copy)
Definition: concurrent_vector.cpp:376
tbb::internal::bool_constant
Definition: tbb_stddef.h:486

References __TBB_ASSERT, tbb::internal::allocator_move_assignment(), tbb::concurrent_vector< T, A >::destroy_array(), tbb::internal::concurrent_vector_base_v3::internal_assign(), tbb::internal::concurrent_vector_base_v3::internal_swap(), tbb::move(), tbb::concurrent_vector< T, A >::move_array(), tbb::concurrent_vector< T, A >::move_assign_array(), tbb::internal::allocator_base< T, A >::my_allocator, and value.

Here is the call graph for this function:

## operator=() [2/4]

template<typename T , class A >

concurrent_vector& tbb::concurrent_vector< T, A >::operator= | ( | const concurrent_vector< T, A > & | vector | ) |

inline

Assignment.

Definition at line 736 of file concurrent_vector.h.

{
if( this != &vector )
internal_assign(vector, sizeof(T), &destroy_array, &assign_array, &copy_array);
return *this;
}
tbb::concurrent_vector::assign_array
static void __TBB_EXPORTED_FUNC assign_array(void *dst, const void *src, size_type n)
Assign (using operator=) n instances of T, starting at "dst" by assigning according element of src ar...
Definition: concurrent_vector.h:1330

References tbb::concurrent_vector< T, A >::assign_array(), tbb::concurrent_vector< T, A >::copy_array(), tbb::concurrent_vector< T, A >::destroy_array(), and tbb::internal::concurrent_vector_base_v3::internal_assign().

Here is the call graph for this function:

## operator=() [3/4]

template<typename T , class A >
template<class M >

__TBB_DEPRECATED concurrent_vector& tbb::concurrent_vector< T, A >::operator= | ( | const concurrent_vector< T, M > & | vector | ) |

inline

Assignment for vector with different allocator type.

Definition at line 762 of file concurrent_vector.h.

{
if( static_cast<void*>( this ) != static_cast<const void*>( &vector ) )
internal_assign(vector.internal_vector_base(),
sizeof(T), &destroy_array, &assign_array, &copy_array);
return *this;
}

References tbb::concurrent_vector< T, A >::assign_array(), tbb::concurrent_vector< T, A >::copy_array(), tbb::concurrent_vector< T, A >::destroy_array(), tbb::internal::concurrent_vector_base_v3::internal_assign(), and tbb::concurrent_vector< T, A >::internal_vector_base().

Here is the call graph for this function:

## operator=() [4/4]

template<typename T , class A >

concurrent_vector& tbb::concurrent_vector< T, A >::operator= | ( | std::initializer_list< T > | init_list | ) |

inline

Assignment for initializer_list.

Definition at line 771 of file concurrent_vector.h.

{
internal_clear(&destroy_array);
internal_assign_iterators(init_list.begin(), init_list.end());
return *this;
}

References tbb::concurrent_vector< T, A >::destroy_array(), tbb::concurrent_vector< T, A >::internal_assign_iterators(), and tbb::internal::concurrent_vector_base_v3::internal_clear().

Here is the call graph for this function:

## operator[]() [1/2]

template<typename T , class A >

reference tbb::concurrent_vector< T, A >::operator[] | ( | size_type | index | ) |

inline

Get reference to element at given index.

This method is thread-safe for concurrent reads, and also while growing the vector, as long as the calling thread has checked that index < size().

Definition at line 867 of file concurrent_vector.h.

{
return internal_subscript(index);
}

References tbb::concurrent_vector< T, A >::internal_subscript().

Here is the call graph for this function:

## operator[]() [2/2]

template<typename T , class A >

const_reference tbb::concurrent_vector< T, A >::operator[] | ( | size_type | index | ) | const

inline

Get const reference to element at given index.

Definition at line 872 of file concurrent_vector.h.

{
return internal_subscript(index);
}

References tbb::concurrent_vector< T, A >::internal_subscript().

Here is the call graph for this function:

## push_back() [1/2]

template<typename T , class A >

iterator tbb::concurrent_vector< T, A >::push_back | ( | const_reference | item | ) |

inline

Push item.

Returns iterator pointing to the new element.

Definition at line 836 of file concurrent_vector.h.

{
push_back_helper prolog(*this);
new(prolog.internal_push_back_result()) T(item);
return prolog.return_iterator_and_dismiss();
}

References tbb::concurrent_vector< T, A >::push_back_helper::internal_push_back_result(), and tbb::concurrent_vector< T, A >::push_back_helper::return_iterator_and_dismiss().

Here is the call graph for this function:

## push_back() [2/2]

template<typename T , class A >

iterator tbb::concurrent_vector< T, A >::push_back | ( | T && | item | ) |

inline

Push item, move-aware.

Returns iterator pointing to the new element.

Definition at line 846 of file concurrent_vector.h.

{
push_back_helper prolog(*this);
new(prolog.internal_push_back_result()) T(std::move(item));
return prolog.return_iterator_and_dismiss();
}

References tbb::concurrent_vector< T, A >::push_back_helper::internal_push_back_result(), tbb::move(), and tbb::concurrent_vector< T, A >::push_back_helper::return_iterator_and_dismiss().

Here is the call graph for this function:

## range() [1/2]

template<typename T , class A >

range_type tbb::concurrent_vector< T, A >::range | ( | size_t | grainsize = `1` | ) |

inline

Get range for iterating with parallel algorithms.

Definition at line 887 of file concurrent_vector.h.

{
return range_type( begin(), end(), grainsize );
}
tbb::concurrent_vector::range_type
generic_range_type< iterator > range_type
Definition: concurrent_vector.h:600

References tbb::concurrent_vector< T, A >::begin(), and tbb::concurrent_vector< T, A >::end().

Here is the call graph for this function:

## range() [2/2]

template<typename T , class A >

const_range_type tbb::concurrent_vector< T, A >::range | ( | size_t | grainsize = `1` | ) | const

inline

Get const range for iterating with parallel algorithms.

Definition at line 892 of file concurrent_vector.h.

{
return const_range_type( begin(), end(), grainsize );
}
tbb::concurrent_vector::const_range_type
generic_range_type< const_iterator > const_range_type
Definition: concurrent_vector.h:601

References tbb::concurrent_vector< T, A >::begin(), and tbb::concurrent_vector< T, A >::end().

Here is the call graph for this function:

## rbegin() [1/2]

template<typename T , class A >

reverse_iterator tbb::concurrent_vector< T, A >::rbegin | ( |  | ) |

inline

reverse start iterator

Definition at line 952 of file concurrent_vector.h.

{return reverse_iterator(end());}
tbb::concurrent_vector::reverse_iterator
std::reverse_iterator< iterator > reverse_iterator
Definition: concurrent_vector.h:589

References tbb::concurrent_vector< T, A >::end().

Here is the call graph for this function:

## rbegin() [2/2]

template<typename T , class A >

const_reverse_iterator tbb::concurrent_vector< T, A >::rbegin | ( |  | ) | const

inline

reverse start const iterator

Definition at line 956 of file concurrent_vector.h.

{return const_reverse_iterator(end());}

References tbb::concurrent_vector< T, A >::end().

Here is the call graph for this function:

## rend() [1/2]

template<typename T , class A >

reverse_iterator tbb::concurrent_vector< T, A >::rend | ( |  | ) |

inline

reverse end iterator

Definition at line 954 of file concurrent_vector.h.

{return reverse_iterator(begin());}

References tbb::concurrent_vector< T, A >::begin().

Here is the call graph for this function:

## rend() [2/2]

template<typename T , class A >

const_reverse_iterator tbb::concurrent_vector< T, A >::rend | ( |  | ) | const

inline

reverse end const iterator

Definition at line 958 of file concurrent_vector.h.

{return const_reverse_iterator(begin());}

References tbb::concurrent_vector< T, A >::begin().

Here is the call graph for this function:

## reserve()

template<typename T , class A >

void tbb::concurrent_vector< T, A >::reserve | ( | size_type | n | ) |

inline

Allocate enough space to grow to size n without having to allocate more memory later.

Like most of the methods provided for STL compatibility, this method is not thread safe. The capacity afterwards may be bigger than the requested reservation.

Definition at line 914 of file concurrent_vector.h.

{
if( n )
internal_reserve(n, sizeof(T), max_size());
}

References tbb::internal::concurrent_vector_base_v3::internal_reserve(), and tbb::concurrent_vector< T, A >::max_size().

Referenced by tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::internal_copy(), and tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::internal_move().

Here is the call graph for this function:
Here is the caller graph for this function:

## resize() [1/2]

template<typename T , class A >

void tbb::concurrent_vector< T, A >::resize | ( | size_type | n | ) |

inline

Resize the vector. Not thread-safe.

Definition at line 920 of file concurrent_vector.h.

{
internal_resize( n, sizeof(T), max_size(), NULL, &destroy_array, &initialize_array );
}

References tbb::concurrent_vector< T, A >::destroy_array(), tbb::concurrent_vector< T, A >::initialize_array(), tbb::internal::concurrent_vector_base_v3::internal_resize(), and tbb::concurrent_vector< T, A >::max_size().

Here is the call graph for this function:

## resize() [2/2]

template<typename T , class A >

void tbb::concurrent_vector< T, A >::resize | ( | size_type | n,
|  | const_reference | t
| ) |  |

inline

Resize the vector, copy t for new elements. Not thread-safe.

Definition at line 925 of file concurrent_vector.h.

{
internal_resize( n, sizeof(T), max_size(), static_cast<const void*>(&t), &destroy_array, &initialize_array_by );
}

References tbb::concurrent_vector< T, A >::destroy_array(), tbb::concurrent_vector< T, A >::initialize_array_by(), tbb::internal::concurrent_vector_base_v3::internal_resize(), and tbb::concurrent_vector< T, A >::max_size().

Here is the call graph for this function:

## shrink_to_fit()

template<typename T , class A >

void tbb::concurrent_vector< T, A >::shrink_to_fit

Optimize memory usage and fragmentation.

Definition at line 1193 of file concurrent_vector.h.

{
internal_segments_table old;
__TBB_TRY {
internal_array_op2 copy_or_move_array =
#if __TBB_MOVE_IF_NOEXCEPT_PRESENT
&move_array_if_noexcept
#else
&copy_array
#endif
;
if( internal_compact( sizeof(T), &old, &destroy_array, copy_or_move_array ) )
internal_free_segments( old.table, pointers_per_long_table, old.first_block ); // free joined and unnecessary segments
} __TBB_CATCH(...) {
if( old.first_block ) // free segment allocated for compacting. Only for support of exceptions in ctor of user T[ype]
internal_free_segments( old.table, 1, old.first_block );
__TBB_RETHROW();
}
}
tbb::internal::concurrent_vector_base_v3::internal_compact
void *__TBB_EXPORTED_METHOD internal_compact(size_type element_size, void *table, internal_array_op1 destroy, internal_array_op2 copy)
Definition: concurrent_vector.cpp:511
tbb::internal::concurrent_vector_base_v3::internal_array_op2
void(__TBB_EXPORTED_FUNC * internal_array_op2)(void *dst, const void *src, size_type n)
An operation on n-element destination array and n-element source array.
Definition: concurrent_vector.h:246
tbb::internal::concurrent_vector_base_v3::pointers_per_long_table
@ pointers_per_long_table
Definition: concurrent_vector.h:96

References __TBB_CATCH, __TBB_RETHROW, __TBB_TRY, tbb::internal::concurrent_vector_base_v3::internal_segments_table::first_block, and tbb::internal::concurrent_vector_base_v3::internal_segments_table::table.

## size()

template<typename T , class A >

size_type tbb::concurrent_vector< T, A >::size | ( |  | ) | const

inline

Return size of vector. It may include elements under construction.

Definition at line 900 of file concurrent_vector.h.

{
size_type sz = my_early_size, cp = internal_capacity();
return cp < sz ? cp : sz;
}

References tbb::internal::concurrent_vector_base_v3::internal_capacity(), and tbb::internal::concurrent_vector_base_v3::my_early_size.

Referenced by tbb::concurrent_vector< T, A >::back(), tbb::concurrent_vector< T, A >::cend(), tbb::concurrent_vector< T, A >::end(), tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::end(), tbb::concurrent_vector< T, A >::front(), tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::internal_copy(), tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::internal_move(), tbb::operator==(), and tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::size().

Here is the call graph for this function:
Here is the caller graph for this function:

## swap()

template<typename T , class A >

void tbb::concurrent_vector< T, A >::swap | ( | concurrent_vector< T, A > & | vector | ) |

inline

swap two instances

Definition at line 1008 of file concurrent_vector.h.

{
typedef typename tbb::internal::allocator_traits<A>::propagate_on_container_swap pocs_t;
if( this != &vector && (this->my_allocator == vector.my_allocator || pocs_t::value) ) {
concurrent_vector_base_v3::internal_swap(static_cast<concurrent_vector_base_v3&>(vector));
tbb::internal::allocator_swap(this->my_allocator, vector.my_allocator, pocs_t());
}
}
tbb::internal::allocator_swap
void allocator_swap(MyAlloc &my_allocator, OtherAlloc &other_allocator, traits_true_type)
Definition: _allocator_traits.h:69
tbb::internal::concurrent_vector_base_v3::concurrent_vector_base_v3
concurrent_vector_base_v3()
Definition: concurrent_vector.h:194

References tbb::internal::allocator_swap(), tbb::internal::concurrent_vector_base_v3::internal_swap(), tbb::internal::allocator_base< T, A >::my_allocator, and value.

Referenced by tbb::swap().

Here is the call graph for this function:
Here is the caller graph for this function:

## Friends And Related Function Documentation

## internal::vector_iterator

template<typename T , class A >
template<typename C , typename U >

friend class internal::vector_iterator

friend

Definition at line 568 of file concurrent_vector.h.

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

- concurrent_vector.h

Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.