#include <concurrent_vector.h>
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 std::reverse_iterator< iterator, T, T &, T * > | reverse_iterator |
typedef std::reverse_iterator< const_iterator, T, const T &, const T * > | 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. | |
concurrent_vector (std::initializer_list< T > init_list, const allocator_type &a=allocator_type()) | |
Constructor from initializer_list. | |
concurrent_vector (const concurrent_vector &vector, const allocator_type &a=allocator_type()) | |
Copying constructor. | |
template<class M> | |
concurrent_vector (const concurrent_vector< T, M > &vector, const allocator_type &a=allocator_type()) | |
Copying constructor for vector with different allocator type. | |
concurrent_vector (size_type n) | |
Construction with initial size specified by argument n. | |
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. | |
template<class I> | |
concurrent_vector (I first, I last, const allocator_type &a=allocator_type()) | |
Construction with copying iteration range and given allocator instance. | |
concurrent_vector & | operator= (const concurrent_vector &vector) |
Assignment. | |
template<class M> | |
concurrent_vector & | operator= (const concurrent_vector< T, M > &vector) |
Assignment for vector with different allocator type. | |
concurrent_vector & | operator= (const std::initializer_list< T > &init_list) |
Assignment for initializer_list. | |
size_type | grow_by (size_type delta) |
Grow by "delta" elements. | |
iterator | grow_by (size_type delta) |
size_type | grow_by (size_type delta, const_reference t) |
Grow by "delta" elements using copying constructor. | |
iterator | grow_by (size_type delta, const_reference t) |
void | grow_to_at_least (size_type n) |
Append minimal sequence of elements such that size()>=n. | |
iterator | grow_to_at_least (size_type n) |
size_type | push_back (const_reference item) iterator push_back(const _reference item) |
Push item. | |
reference | operator[] (size_type index) |
Get reference to element at given index. | |
const_reference | operator[] (size_type index) const |
Get const reference to element at given index. | |
reference | at (size_type index) |
Get reference to element at given index. Throws exceptions on errors. | |
const_reference | at (size_type index) const |
Get const reference to element at given index. Throws exceptions on errors. | |
range_type | range (size_t grainsize=1) |
Get range for iterating with parallel algorithms. | |
const_range_type | range (size_t grainsize=1) const |
Get const range for iterating with parallel algorithms. | |
size_type | size () const |
Return size of vector. It may include elements under construction. | |
bool | empty () const |
Return false if vector is not empty or has elements under construction at least. | |
size_type | capacity () const |
Maximum size to which array can grow without allocating more memory. Concurrent allocations are not included in the value. | |
void | reserve (size_type n) |
Allocate enough space to grow to size n without having to allocate more memory later. | |
void | resize (size_type n) |
Resize the vector. Not thread-safe. | |
void | resize (size_type n, const_reference t) |
Resize the vector, copy t for new elements. Not thread-safe. | |
void | compact () |
An alias for shrink_to_fit(). | |
void | shrink_to_fit () |
Optimize memory usage and fragmentation. | |
size_type | max_size () const |
Upper bound on argument to reserve. | |
iterator | begin () |
start iterator | |
iterator | end () |
end iterator | |
const_iterator | begin () const |
start const iterator | |
const_iterator | end () const |
end const iterator | |
const_iterator | cbegin () const |
start const iterator | |
const_iterator | cend () const |
end const iterator | |
reverse_iterator | rbegin () |
reverse start iterator | |
reverse_iterator | rend () |
reverse end iterator | |
const_reverse_iterator | rbegin () const |
reverse start const iterator | |
const_reverse_iterator | rend () const |
reverse end const iterator | |
const_reverse_iterator | crbegin () const |
reverse start const iterator | |
const_reverse_iterator | crend () const |
reverse end const iterator | |
reference | front () |
the first item | |
const_reference | front () const |
the first item const | |
reference | back () |
the last item | |
const_reference | back () const |
the last item const | |
allocator_type | get_allocator () const |
return allocator object | |
void | assign (size_type n, const_reference t) |
assign n items by copying t item | |
template<class I> | |
void | assign (I first, I last) |
assign range [first, last) | |
void | assign (std::initializer_list< T > init_list) |
assigns an initializer list | |
void | swap (concurrent_vector &vector) |
swap two instances | |
void | clear () |
Clear container while keeping memory allocated. | |
~concurrent_vector () | |
Clear and destroy vector. | |
const internal::concurrent_vector_base_v3 & | internal_vector_base () const |
Friends | |
class | internal::vector_iterator |
Classes | |
class | generic_range_type |
class | internal_loop_guide |
Exception-aware helper class for filling a segment by exception-danger operators of user class. |
concurrent_vector is a container having the following main properties:
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
iterator tbb::concurrent_vector< T, A >::grow_by | ( | size_type | delta, | |
const_reference | t | |||
) | [inline] |
Returns iterator pointing to the first new element.
size_type tbb::concurrent_vector< T, A >::grow_by | ( | size_type | delta, | |
const_reference | t | |||
) | [inline] |
Grow by "delta" elements using copying constructor.
Returns old size.
iterator tbb::concurrent_vector< T, A >::grow_by | ( | size_type | delta | ) | [inline] |
Returns iterator pointing to the first new element.
size_type tbb::concurrent_vector< T, A >::grow_by | ( | size_type | delta | ) | [inline] |
Grow by "delta" elements.
Returns old size.
iterator tbb::concurrent_vector< T, A >::grow_to_at_least | ( | size_type | n | ) | [inline] |
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.
void 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.
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().
size_type tbb::concurrent_vector< T, A >::push_back | ( | const_reference | item | ) | const [inline] |
Push item.
Returns iterator pointing to the new element.
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.