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

#include <concurrent_vector.h>

Public Types

using value_type = T
 
using reference = T &
 
using const_reference = const T &
 
using size_type = size_t
 
using difference_type = ssize_t
 
using reference_type = T &
 
using const_reference_type = const T &
 
using pointer = T *
 
using const_pointer = const T *
 
using iterator = std::conditional_t< Traits::kIteratorPreferSpeed, cv::ConcurrentVectorIterator< ConcurrentVector< T, Traits >, T, false >, cv::CompactCVecIterator< ConcurrentVector< T, Traits >, T, false > >
 
using const_iterator = std::conditional_t< Traits::kIteratorPreferSpeed, cv::ConcurrentVectorIterator< ConcurrentVector< T, Traits >, T, true >, cv::CompactCVecIterator< ConcurrentVector< T, Traits >, T, true > >
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 

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)
 
ConcurrentVectoroperator= (const ConcurrentVector &other)
 
ConcurrentVectoroperator= (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 Toperator[] (size_type index) const
 
Toperator[] (size_type index)
 
const Tat (size_type index) const
 
Tat (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
 
Tfront ()
 
const Tfront () const
 
Tback ()
 
const Tback () const
 
void swap (ConcurrentVector &oth)
 

Friends

class cv::ConVecIterBase< ConcurrentVector< T, Traits >, T >
 
class cv::ConcurrentVectorIterator< ConcurrentVector< T, Traits >, T, false >
 
class cv::ConcurrentVectorIterator< ConcurrentVector< T, Traits >, T, true >
 

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.

Definition at line 157 of file concurrent_vector.h.

Member Typedef Documentation

◆ const_iterator

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
using dispenso::ConcurrentVector< T, Traits, SizeTraits >::const_iterator = std::conditional_t< Traits::kIteratorPreferSpeed, cv::ConcurrentVectorIterator<ConcurrentVector<T, Traits>, T, true>, cv::CompactCVecIterator<ConcurrentVector<T, Traits>, T, true> >

Definition at line 172 of file concurrent_vector.h.

◆ const_pointer

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
using dispenso::ConcurrentVector< T, Traits, SizeTraits >::const_pointer = const T*

Definition at line 167 of file concurrent_vector.h.

◆ const_reference

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
using dispenso::ConcurrentVector< T, Traits, SizeTraits >::const_reference = const T&

Definition at line 161 of file concurrent_vector.h.

◆ const_reference_type

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
using dispenso::ConcurrentVector< T, Traits, SizeTraits >::const_reference_type = const T&

Definition at line 165 of file concurrent_vector.h.

◆ const_reverse_iterator

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
using dispenso::ConcurrentVector< T, Traits, SizeTraits >::const_reverse_iterator = std::reverse_iterator<const_iterator>

Definition at line 177 of file concurrent_vector.h.

◆ difference_type

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
using dispenso::ConcurrentVector< T, Traits, SizeTraits >::difference_type = ssize_t

Definition at line 163 of file concurrent_vector.h.

◆ iterator

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
using dispenso::ConcurrentVector< T, Traits, SizeTraits >::iterator = std::conditional_t< Traits::kIteratorPreferSpeed, cv::ConcurrentVectorIterator<ConcurrentVector<T, Traits>, T, false>, cv::CompactCVecIterator<ConcurrentVector<T, Traits>, T, false> >

Definition at line 168 of file concurrent_vector.h.

◆ pointer

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
using dispenso::ConcurrentVector< T, Traits, SizeTraits >::pointer = T*

Definition at line 166 of file concurrent_vector.h.

◆ reference

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
using dispenso::ConcurrentVector< T, Traits, SizeTraits >::reference = T&

Definition at line 160 of file concurrent_vector.h.

◆ reference_type

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
using dispenso::ConcurrentVector< T, Traits, SizeTraits >::reference_type = T&

Definition at line 164 of file concurrent_vector.h.

◆ reverse_iterator

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
using dispenso::ConcurrentVector< T, Traits, SizeTraits >::reverse_iterator = std::reverse_iterator<iterator>

Definition at line 176 of file concurrent_vector.h.

◆ size_type

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
using dispenso::ConcurrentVector< T, Traits, SizeTraits >::size_type = size_t

Definition at line 162 of file concurrent_vector.h.

◆ value_type

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

Definition at line 159 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 182 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 189 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 201 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 212 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 225 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 234 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 244 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 250 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 256 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 461 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 331 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 311 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 789 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 771 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).

Definition at line 967 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 976 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.

Definition at line 805 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 830 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.

Definition at line 401 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 855 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 867 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 416 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 393 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 612 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 924 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.

Definition at line 817 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 842 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 566 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 541 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.

Definition at line 950 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 958 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 681 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 662 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.

Definition at line 651 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 692 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.

Definition at line 637 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.

Definition at line 702 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 717 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 473 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 518 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 498 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 531 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 485 of file concurrent_vector.h.

◆ max_size()

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
constexpr 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 933 of file concurrent_vector.h.

◆ operator=() [1/2]

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

Move assignment operator. This is not concurrency safe.

Definition at line 288 of file concurrent_vector.h.

◆ operator=() [2/2]

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

Copy assignment operator. This is not concurrency safe.

Definition at line 272 of file concurrent_vector.h.

◆ operator[]() [1/2]

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

Access an element of the vector. 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 756 of file concurrent_vector.h.

◆ operator[]() [2/2]

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

Access an element of the vector. 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 742 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 728 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.

Definition at line 593 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 602 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 881 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 904 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 892 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 915 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 344 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 353 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 374 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 439 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.

Definition at line 942 of file concurrent_vector.h.

◆ swap()

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

Swap the contents (and iterators, and element references) of the current vector with oth.

Parameters
othThe vector to swap with.

Definition at line 984 of file concurrent_vector.h.

Friends And Related Symbol Documentation

◆ cv::ConcurrentVectorIterator< ConcurrentVector< T, Traits >, T, false >

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
friend class cv::ConcurrentVectorIterator< ConcurrentVector< T, Traits >, T, false >
friend

Definition at line 1086 of file concurrent_vector.h.

◆ cv::ConcurrentVectorIterator< ConcurrentVector< T, Traits >, T, true >

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
friend class cv::ConcurrentVectorIterator< ConcurrentVector< T, Traits >, T, true >
friend

Definition at line 1086 of file concurrent_vector.h.

◆ cv::ConVecIterBase< ConcurrentVector< T, Traits >, T >

template<typename T , typename Traits = DefaultConcurrentVectorTraits, typename SizeTraits = DefaultConcurrentVectorSizeTraits<T>>
friend class cv::ConVecIterBase< ConcurrentVector< T, Traits >, T >
friend

Definition at line 1086 of file concurrent_vector.h.


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