#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 (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. | |
size_type | grow_by (size_type delta) |
Grow by "delta" elements. | |
size_type | grow_by (size_type delta, const_reference t) |
Grow by "delta" elements using copying constuctor. | |
void | grow_to_at_least (size_type n) |
Grow array until it has at least n elements. | |
size_type | 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. | |
const_reference | at (size_type index) const |
Get const reference to element at given index. | |
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. | |
bool | empty () const |
Return size of vector. | |
size_type | capacity () const |
Maximum size to which array can grow without allocating more memory. | |
void | reserve (size_type n) |
Allocate enough space to grow to size n without having to allocate more memory later. | |
void | compact () |
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 | |
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 | |
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 | 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
size_type tbb::concurrent_vector< T, A >::grow_by | ( | size_type | delta, | |
const_reference | t | |||
) | [inline] |
Grow by "delta" elements using copying constuctor.
Returns old size.
size_type tbb::concurrent_vector< T, A >::grow_by | ( | size_type | delta | ) | [inline] |
Grow by "delta" elements.
Returns old size.
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().
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.