dispenso 1.4.1
A library for task parallelism
Loading...
Searching...
No Matches
dispenso::ConcurrentVector< T, Traits, SizeTraits > Class Template Reference

#include <concurrent_vector.h>

Public Member Functions

 ConcurrentVector ()
 
 ConcurrentVector (size_t startCapacity, ReserveTagS)
 
 ConcurrentVector (size_t startSize)
 
 ConcurrentVector (size_t startSize, const T &defaultValue)
 
template<typename InIterator >
 ConcurrentVector (InIterator start, InIterator end)
 
template<typename InIterator >
 ConcurrentVector (size_type startSize, InIterator start, InIterator end)
 
 ConcurrentVector (std::initializer_list< T > l)
 
 ConcurrentVector (const ConcurrentVector &other)
 
 ConcurrentVector (ConcurrentVector &&other)
 
void assign (size_type count, const T &value)
 
template<typename It , typename = typename std::iterator_traits<It>::difference_type, typename = typename std::iterator_traits<It>::pointer, typename = typename std::iterator_traits<It>::reference, typename = typename std::iterator_traits<It>::value_type, typename = typename std::iterator_traits<It>::iterator_category>
void assign (It start, It end)
 
void reserve (difference_type capacity)
 
void resize (difference_type len)
 
void resize (difference_type len, const T &value)
 
size_type default_capacity () const
 
size_type capacity () const
 
void clear ()
 
void shrink_to_fit ()
 
 ~ConcurrentVector ()
 
iterator insert (const_iterator pos, const T &value)
 
iterator insert (const_iterator pos, T &&value)
 
iterator insert (const_iterator pos, size_type count, const T &value)
 
template<typename InputIt , typename = typename std::iterator_traits<InputIt>::difference_type, typename = typename std::iterator_traits<InputIt>::pointer, typename = typename std::iterator_traits<InputIt>::reference, typename = typename std::iterator_traits<InputIt>::value_type, typename = typename std::iterator_traits<InputIt>::iterator_category>
iterator insert (const_iterator pos, InputIt first, InputIt last)
 
iterator insert (const_iterator pos, std::initializer_list< T > ilist)
 
iterator erase (const_iterator pos)
 
iterator erase (const_iterator first, const_iterator last)
 
iterator push_back (const T &val)
 
iterator push_back (T &&val)
 
template<typename... Args>
iterator emplace_back (Args &&... args)
 
template<typename Gen >
iterator grow_by_generator (size_type delta, Gen gen)
 
iterator grow_by (size_type delta, const T &t)
 
iterator grow_by (size_type delta)
 
template<typename It , typename = typename std::iterator_traits<It>::difference_type, typename = typename std::iterator_traits<It>::pointer, typename = typename std::iterator_traits<It>::reference, typename = typename std::iterator_traits<It>::value_type, typename = typename std::iterator_traits<It>::iterator_category>
iterator grow_by (It start, It end)
 
iterator grow_by (std::initializer_list< T > initList)
 
iterator grow_to_at_least (size_type n)
 
iterator grow_to_at_least (size_type n, const T &t)
 
void pop_back ()
 
const T & at (size_type index) const
 
T & at (size_type index)
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
reverse_iterator rbegin ()
 
reverse_iterator rend ()
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
bool empty () const
 
constexpr size_type max_size () const noexcept
 
size_type size () const
 
T & front ()
 
const T & front () const
 
T & back ()
 
const T & back () const
 

Detailed Description

template<typename T, typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
class dispenso::ConcurrentVector< T, Traits, SizeTraits >

A concurrent vector type. It is safe to call .push_back(), .emplace_back(), the various .grow_() functions, .begin(), .end(), .size(), .empty() concurrently, and existing iterators and references remain valid with these functions' use.

Examples
concurrent_vector_example.cpp.

Definition at line 158 of file concurrent_vector.h.

Constructor & Destructor Documentation

◆ ConcurrentVector() [1/9]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
dispenso::ConcurrentVector< T, Traits, SizeTraits >::ConcurrentVector ( )
inline

Default construct the ConcurrentVector.

Definition at line 183 of file concurrent_vector.h.

◆ ConcurrentVector() [2/9]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
dispenso::ConcurrentVector< T, Traits, SizeTraits >::ConcurrentVector ( size_t startCapacity,
ReserveTagS  )
inline

The reserving constructor. By supplying a reasonable starting capacity, e.g. close to max expected vector size, this can often improve performance substantially by reducing allocations and increasing data coherency.

Definition at line 190 of file concurrent_vector.h.

◆ ConcurrentVector() [3/9]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
dispenso::ConcurrentVector< T, Traits, SizeTraits >::ConcurrentVector ( size_t startSize)
inlineexplicit

Sizing constructor with default initialization.

Definition at line 203 of file concurrent_vector.h.

◆ ConcurrentVector() [4/9]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
dispenso::ConcurrentVector< T, Traits, SizeTraits >::ConcurrentVector ( size_t startSize,
const T & defaultValue )
inline

Sizing constructor with specified default value.

Definition at line 214 of file concurrent_vector.h.

◆ ConcurrentVector() [5/9]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
template<typename InIterator >
dispenso::ConcurrentVector< T, Traits, SizeTraits >::ConcurrentVector ( InIterator start,
InIterator end )
inline

Constructor taking an iterator range.

Definition at line 227 of file concurrent_vector.h.

◆ ConcurrentVector() [6/9]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
template<typename InIterator >
dispenso::ConcurrentVector< T, Traits, SizeTraits >::ConcurrentVector ( size_type startSize,
InIterator start,
InIterator end )
inline

Sizing constructor taking an iterator range. If size is known in advance, this may be faster than just providing the iterator range, especially for input iterators that are not random access.

Definition at line 236 of file concurrent_vector.h.

◆ ConcurrentVector() [7/9]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
dispenso::ConcurrentVector< T, Traits, SizeTraits >::ConcurrentVector ( std::initializer_list< T > l)
inline

Construct via initializer list

Definition at line 246 of file concurrent_vector.h.

◆ ConcurrentVector() [8/9]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
dispenso::ConcurrentVector< T, Traits, SizeTraits >::ConcurrentVector ( const ConcurrentVector< T, Traits, SizeTraits > & other)
inline

Copy constructor

Definition at line 252 of file concurrent_vector.h.

◆ ConcurrentVector() [9/9]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
dispenso::ConcurrentVector< T, Traits, SizeTraits >::ConcurrentVector ( ConcurrentVector< T, Traits, SizeTraits > && other)
inline

Move constructor

Definition at line 258 of file concurrent_vector.h.

◆ ~ConcurrentVector()

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
dispenso::ConcurrentVector< T, Traits, SizeTraits >::~ConcurrentVector ( )
inline

Destruct the vector.

Definition at line 463 of file concurrent_vector.h.

Member Function Documentation

◆ assign() [1/2]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
template<typename It , typename = typename std::iterator_traits<It>::difference_type, typename = typename std::iterator_traits<It>::pointer, typename = typename std::iterator_traits<It>::reference, typename = typename std::iterator_traits<It>::value_type, typename = typename std::iterator_traits<It>::iterator_category>
void dispenso::ConcurrentVector< T, Traits, SizeTraits >::assign ( It start,
It end )
inline

Assign the vector. Not concurrency safe.

Parameters
startThe beginning of the iterator range to assign into the vector
endThe end of the iterator range to assign into the vector

Definition at line 333 of file concurrent_vector.h.

◆ assign() [2/2]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
void dispenso::ConcurrentVector< T, Traits, SizeTraits >::assign ( size_type count,
const T & value )
inline

Assign the vector. Not concurrency safe.

Parameters
countThe number of elements to have in the vector
valueThe value to copy into each element

Definition at line 313 of file concurrent_vector.h.

◆ at() [1/2]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
T & dispenso::ConcurrentVector< T, Traits, SizeTraits >::at ( size_type index)
inline

Access an element of the vector. Out-of-boundes accesses generate an exception. Concurrency safe.

Parameters
indexThe index of the element to access.
Returns
A reference to the element at index.
Note
Iterators and references are stable even if other threads are inserting, but it is still the users responsibility to avoid racing on the element itself.

Definition at line 791 of file concurrent_vector.h.

◆ at() [2/2]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
const T & dispenso::ConcurrentVector< T, Traits, SizeTraits >::at ( size_type index) const
inline

Access an element of the vector. Out-of-boundes accesses generate an exception. Concurrency safe.

Parameters
indexThe index of the element to access.
Returns
A reference to the element at index.
Note
Iterators and references are stable even if other threads are inserting, but it is still the users responsibility to avoid racing on the element itself.

Definition at line 773 of file concurrent_vector.h.

◆ back() [1/2]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
T & dispenso::ConcurrentVector< T, Traits, SizeTraits >::back ( )
inline

Get the last element of the vector. Concurrency safe.

Returns
A reference to the last element in the vector. Note that elements could be appended concurrently with this call (in which case it won't be the back anymore).
Examples
concurrent_vector_example.cpp.

Definition at line 969 of file concurrent_vector.h.

◆ back() [2/2]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
const T & dispenso::ConcurrentVector< T, Traits, SizeTraits >::back ( ) const
inline

Get the last element of the vector. Concurrency safe.

Returns
A reference to the last element in the vector. Note that elements could be appended concurrently with this call (in which case it won't be the back anymore).

Definition at line 978 of file concurrent_vector.h.

◆ begin() [1/2]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::begin ( )
inline

Get an iterator to the start of the vector. Concurrency safe.

Returns
An iterator to the start of the vector.
Note
Iterators and references are stable even if other threads are inserting, but it is still the users responsibility to avoid racing on the element itself.
Examples
concurrent_vector_example.cpp.

Definition at line 807 of file concurrent_vector.h.

◆ begin() [2/2]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
const_iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::begin ( ) const
inline

Get an iterator to the start of the vector. Concurrency safe.

Returns
An iterator to the start of the vector.
Note
Iterators and references are stable even if other threads are inserting, but it is still the users responsibility to avoid racing on the element itself.

Definition at line 832 of file concurrent_vector.h.

◆ capacity()

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
size_type dispenso::ConcurrentVector< T, Traits, SizeTraits >::capacity ( ) const
inline

The current capacity of the vector. Not concurrency safe.

Returns
The current capacity.
Examples
concurrent_vector_example.cpp.

Definition at line 403 of file concurrent_vector.h.

◆ cbegin()

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
const_iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::cbegin ( ) const
inline

Get an iterator to the start of the vector. Concurrency safe.

Returns
An iterator to the start of the vector.
Note
Iterators and references are stable even if other threads are inserting, but it is still the users responsibility to avoid racing on the element itself.

Definition at line 857 of file concurrent_vector.h.

◆ cend()

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
const_iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::cend ( ) const
inline

Get an iterator to the end of the vector. Concurrency safe.

Returns
An iterator to the end of the vector. Note that it is possible for the end to change concurrently with this call.
Note
Iterators and references are stable even if other threads are inserting, but it is still the users responsibility to avoid racing on the element itself.

Definition at line 869 of file concurrent_vector.h.

◆ clear()

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
void dispenso::ConcurrentVector< T, Traits, SizeTraits >::clear ( )
inline

Clear the vector. This does not deallocate buffers, but just ensures that all elements are destructed. Size will be zero after the call. Not concurrency safe.

Definition at line 418 of file concurrent_vector.h.

◆ default_capacity()

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
size_type dispenso::ConcurrentVector< T, Traits, SizeTraits >::default_capacity ( ) const
inline

The default capacity of this vector.

Returns
The capacity if the vector were cleared and then called shrink_to_fit.

Definition at line 395 of file concurrent_vector.h.

◆ emplace_back()

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
template<typename... Args>
iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::emplace_back ( Args &&... args)
inline

Push a value onto the end of the vector. Concurrency safe.

Parameters
argsThe arg pack used to construct the new element.
Returns
The iterator at the point of insertion.

Definition at line 614 of file concurrent_vector.h.

◆ empty()

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
bool dispenso::ConcurrentVector< T, Traits, SizeTraits >::empty ( ) const
inline

Checks if the vector contains any elements. Concurrency safe.

Returns
true if the vector contains no elements, false otherwise. Note that an element could be appended concurrently with this call.

Definition at line 926 of file concurrent_vector.h.

◆ end() [1/2]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::end ( )
inline

Get an iterator to the end of the vector. Concurrency safe.

Returns
An iterator to the end of the vector. Note that it is possible for the end to change concurrently with this call.
Note
Iterators and references are stable even if other threads are inserting, but it is still the users responsibility to avoid racing on the element itself.
Examples
concurrent_vector_example.cpp.

Definition at line 819 of file concurrent_vector.h.

◆ end() [2/2]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
const_iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::end ( ) const
inline

Get an iterator to the end of the vector. Concurrency safe.

Returns
An iterator to the end of the vector. Note that it is possible for the end to change concurrently with this call.
Note
Iterators and references are stable even if other threads are inserting, but it is still the users responsibility to avoid racing on the element itself.

Definition at line 844 of file concurrent_vector.h.

◆ erase() [1/2]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::erase ( const_iterator first,
const_iterator last )
inline

Erase a range of elements. Not concurrency safe.

Parameters
firstThe starting point of erasure.
lastThe ending point of erasure.
Returns
Iterator following the last removed element. If pos refers to the last element, then the end() iterator is returned. If last==end() prior to removal, then the updated end() iterator is returned. If [first, last) is an empty range, then last is returned.

Definition at line 568 of file concurrent_vector.h.

◆ erase() [2/2]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::erase ( const_iterator pos)
inline

Erase one element. Not concurrency safe.

Parameters
posThe point of erasure.
Returns
Iterator following the removed element. If pos refers to the last element, then the end() iterator is returned.

Definition at line 543 of file concurrent_vector.h.

◆ front() [1/2]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
T & dispenso::ConcurrentVector< T, Traits, SizeTraits >::front ( )
inline

Get the front element of the vector. Concurrency safe.

Returns
A reference to the first element in the vector.
Examples
concurrent_vector_example.cpp.

Definition at line 952 of file concurrent_vector.h.

◆ front() [2/2]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
const T & dispenso::ConcurrentVector< T, Traits, SizeTraits >::front ( ) const
inline

Get the front element of the vector. Concurrency safe.

Returns
A reference to the first element in the vector.

Definition at line 960 of file concurrent_vector.h.

◆ grow_by() [1/4]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
template<typename It , typename = typename std::iterator_traits<It>::difference_type, typename = typename std::iterator_traits<It>::pointer, typename = typename std::iterator_traits<It>::reference, typename = typename std::iterator_traits<It>::value_type, typename = typename std::iterator_traits<It>::iterator_category>
iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::grow_by ( It start,
It end )
inline

Grow the vector with an input iterator range. Concurrency safe.

Parameters
startThe start of the input iterator range.
endThe end of the input iterator range.
Returns
The iterator to the start of the grown range.

Definition at line 683 of file concurrent_vector.h.

◆ grow_by() [2/4]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::grow_by ( size_type delta)
inline

Grow the vector, default initializing new elements. Concurrency safe.

Parameters
deltaThe number of elements to grow by.
Returns
The iterator to the start of the grown range.

Definition at line 664 of file concurrent_vector.h.

◆ grow_by() [3/4]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::grow_by ( size_type delta,
const T & t )
inline

Grow the vector, copying the provided value into new elements. Concurrency safe.

Parameters
deltaThe number of elements to grow by.
tThe value to copy into all new elements.
Returns
The iterator to the start of the grown range.
Examples
concurrent_vector_example.cpp.

Definition at line 653 of file concurrent_vector.h.

◆ grow_by() [4/4]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::grow_by ( std::initializer_list< T > initList)
inline

Grow the vector with an initializer_list. Concurrency safe.

Parameters
initListThe initializer_list to use to initialize the newly added range.
Returns
The iterator to the start of the grown range.

Definition at line 694 of file concurrent_vector.h.

◆ grow_by_generator()

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
template<typename Gen >
iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::grow_by_generator ( size_type delta,
Gen gen )
inline

Grow the vector, constructing new elements via a generator. Concurrency safe.

Parameters
deltaThe number of elements to grow by.
genThe generator to use to construct new elements. Must have operator()() and return a valid T.
Returns
The iterator to the start of the grown range.
Examples
concurrent_vector_example.cpp.

Definition at line 639 of file concurrent_vector.h.

◆ grow_to_at_least() [1/2]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::grow_to_at_least ( size_type n)
inline

Grow the vector to at least the desired size, default initializing new elements. Concurrency safe.

Parameters
nThe required length
Returns
The iterator to the nth element.
Examples
concurrent_vector_example.cpp.

Definition at line 704 of file concurrent_vector.h.

◆ grow_to_at_least() [2/2]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::grow_to_at_least ( size_type n,
const T & t )
inline

Grow the vector to at least the desired size, copying the provided value into new elements. Concurrency safe.

Parameters
nThe required length
tThe value to copy into each new element.
Returns
The iterator to the nth element.

Definition at line 719 of file concurrent_vector.h.

◆ insert() [1/5]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::insert ( const_iterator pos,
const T & value )
inline

Insert a value. Not concurrency safe.

Parameters
posThe point of insertion.
valueThe value to copy into the element at pos.
Returns
The iterator at the inserted position.

Definition at line 475 of file concurrent_vector.h.

◆ insert() [2/5]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
template<typename InputIt , typename = typename std::iterator_traits<InputIt>::difference_type, typename = typename std::iterator_traits<InputIt>::pointer, typename = typename std::iterator_traits<InputIt>::reference, typename = typename std::iterator_traits<InputIt>::value_type, typename = typename std::iterator_traits<InputIt>::iterator_category>
iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::insert ( const_iterator pos,
InputIt first,
InputIt last )
inline

Insert a range of values. Not concurrency safe.

Parameters
posThe point of insertion.
firstThe start of the input iterator range.
lastThe end of the input iterator range.
Returns
The iterator at the inserted position.

Definition at line 520 of file concurrent_vector.h.

◆ insert() [3/5]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::insert ( const_iterator pos,
size_type count,
const T & value )
inline

Insert a value. Not concurrency safe.

Parameters
posThe point of insertion.
countThe number of elements to insert.
valueThe value to copy into each inserted element starting at pos.
Returns
The iterator at the inserted position.

Definition at line 500 of file concurrent_vector.h.

◆ insert() [4/5]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::insert ( const_iterator pos,
std::initializer_list< T > ilist )
inline

Insert an initializer_list. Not concurrency safe.

Parameters
posThe point of insertion.
ilistThe initializer_list.
Returns
The iterator at the inserted position.

Definition at line 533 of file concurrent_vector.h.

◆ insert() [5/5]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::insert ( const_iterator pos,
T && value )
inline

Insert a value. Not concurrency safe.

Parameters
posThe point of insertion.
valueThe value to move into the element at pos.
Returns
The iterator at the inserted position.

Definition at line 487 of file concurrent_vector.h.

◆ max_size()

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
size_type dispenso::ConcurrentVector< T, Traits, SizeTraits >::max_size ( ) const
inlineconstexprnoexcept

Get the maximum size a vector of this type can theoretically have. Concurrency safe (constexpr).

Returns
The max size a vector of this type could theoretically have.

Definition at line 935 of file concurrent_vector.h.

◆ pop_back()

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
void dispenso::ConcurrentVector< T, Traits, SizeTraits >::pop_back ( )
inline

Pop the last element off the vector. Not concurrency safe.

Definition at line 730 of file concurrent_vector.h.

◆ push_back() [1/2]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::push_back ( const T & val)
inline

Push a value onto the end of the vector. Concurrency safe.

Parameters
valThe value to copy into the new element.
Returns
The iterator at the point of insertion.
Examples
concurrent_vector_example.cpp.

Definition at line 595 of file concurrent_vector.h.

◆ push_back() [2/2]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::push_back ( T && val)
inline

Push a value onto the end of the vector. Concurrency safe.

Parameters
valThe value to move into the new element.
Returns
The iterator at the point of insertion.

Definition at line 604 of file concurrent_vector.h.

◆ rbegin() [1/2]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
reverse_iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::rbegin ( )
inline

Get a starting reverse iterator to the vector. Concurrency safe.

Returns
A starting reverse iterator to the vector. Note that it is possible for the the rbegin to change concurrently with this call.
Note
Iterators and references are stable even if other threads are inserting, but it is still the users responsibility to avoid racing on the element itself.

Definition at line 883 of file concurrent_vector.h.

◆ rbegin() [2/2]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
const_reverse_iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::rbegin ( ) const
inline

Get a starting reverse iterator to the vector. Concurrency safe.

Returns
A starting reverse iterator to the vector. Note that it is possible for the the rbegin to change concurrently with this call.
Note
Iterators and references are stable even if other threads are inserting, but it is still the users responsibility to avoid racing on the element itself.

Definition at line 906 of file concurrent_vector.h.

◆ rend() [1/2]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
reverse_iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::rend ( )
inline

Get an ending reverse iterator to the vector. Concurrency safe.

Returns
An ending reverse iterator to the vector.
Note
Iterators and references are stable even if other threads are inserting, but it is still the users responsibility to avoid racing on the element itself.

Definition at line 894 of file concurrent_vector.h.

◆ rend() [2/2]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
const_reverse_iterator dispenso::ConcurrentVector< T, Traits, SizeTraits >::rend ( ) const
inline

Get an ending reverse iterator to the vector. Concurrency safe.

Returns
An ending reverse iterator to the vector.
Note
Iterators and references are stable even if other threads are inserting, but it is still the users responsibility to avoid racing on the element itself.

Definition at line 917 of file concurrent_vector.h.

◆ reserve()

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
void dispenso::ConcurrentVector< T, Traits, SizeTraits >::reserve ( difference_type capacity)
inline

Reserve some capacity for the vector. Not concurrency safe.

Parameters
capacityThe amount of space to ensure is available to avoid further allocations.

Definition at line 346 of file concurrent_vector.h.

◆ resize() [1/2]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
void dispenso::ConcurrentVector< T, Traits, SizeTraits >::resize ( difference_type len)
inline

Resize the vector, using default initialization for any new values. Not concurrency safe.

Parameters
lenThe length of the vector after the resize.

Definition at line 355 of file concurrent_vector.h.

◆ resize() [2/2]

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
void dispenso::ConcurrentVector< T, Traits, SizeTraits >::resize ( difference_type len,
const T & value )
inline

Resize the vector, copying the provided value into any new elements. Not concurrency safe.

Parameters
lenThe length of the vector after the resize.
valueThe value to copy into any new elements.

Definition at line 376 of file concurrent_vector.h.

◆ shrink_to_fit()

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
void dispenso::ConcurrentVector< T, Traits, SizeTraits >::shrink_to_fit ( )
inline

Gets rid of extra capacity that is not needed to maintain preconditions. At least the default capacity will remain, even if the size of the vector is zero. Not concurrency safe.

Definition at line 441 of file concurrent_vector.h.

◆ size()

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
size_type dispenso::ConcurrentVector< T, Traits, SizeTraits >::size ( ) const
inline

Get the size of the vector. Concurrency safe.

Returns
The number of elements in the vector. Note that elements can be appended concurrently with this call.
Examples
concurrent_vector_example.cpp.

Definition at line 944 of file concurrent_vector.h.


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