concurrent_vector.h
Go to the documentation of this file.
/*
Copyright (c) 2005-2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef __TBB_concurrent_vector_H
#define __TBB_concurrent_vector_H
#define __TBB_concurrent_vector_H_include_area
#include "internal/_warning_suppress_enable_notice.h"
#include "tbb_stddef.h"
#include "tbb_exception.h"
#include "atomic.h"
#include "cache_aligned_allocator.h"
#include "blocked_range.h"
#include "tbb_machine.h"
#include "tbb_profiling.h"
#include <new>
#include <cstring> // for memset()
#include __TBB_STD_SWAP_HEADER
#include <algorithm>
#include <iterator>
#include "internal/_allocator_traits.h"
#if _MSC_VER==1500 && !__INTEL_COMPILER
// VS2008/VC9 seems to have an issue; limits pull in math.h
#pragma warning( push )
#pragma warning( disable: 4985 )
#endif
#include <limits> /* std::numeric_limits */
#if _MSC_VER==1500 && !__INTEL_COMPILER
#pragma warning( pop )
#endif
#if __TBB_INITIALIZER_LISTS_PRESENT
#include <initializer_list>
#endif
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
// Workaround for overzealous compiler warnings in /Wp64 mode
#pragma warning (push)
#if defined(_Wp64)
#pragma warning (disable: 4267)
#endif
#pragma warning (disable: 4127) //warning C4127: conditional expression is constant
#endif
namespace tbb {
template<typename T, class A = cache_aligned_allocator<T> >
class concurrent_vector;
namespace internal {
template<typename Container, typename Value>
class vector_iterator;
static void *const vector_allocation_error_flag = reinterpret_cast<void*>(size_t(63));
template<typename T>
void handle_unconstructed_elements(T* array, size_t n_of_elements){
std::memset( static_cast<void*>(array), 0, n_of_elements * sizeof( T ) );
}
class concurrent_vector_base_v3 {
protected:
// Basic types declarations
typedef size_t segment_index_t;
typedef size_t size_type;
// Using enumerations due to Mac linking problems of static const variables
enum {
// Size constants
default_initial_segments = 1, // 2 initial items
pointers_per_short_table = 3, // to fit into 8 words of entire structure
pointers_per_long_table = sizeof(segment_index_t) * 8 // one segment per bit
};
struct segment_not_used {};
struct segment_allocated {};
struct segment_allocation_failed {};
class segment_t;
class segment_value_t {
void* array;
private:
//TODO: More elegant way to grant access to selected functions _only_?
friend class segment_t;
explicit segment_value_t(void* an_array):array(an_array) {}
public:
friend bool operator==(segment_value_t const& lhs, segment_not_used ) { return lhs.array == 0;}
friend bool operator==(segment_value_t const& lhs, segment_allocated) { return lhs.array > internal::vector_allocation_error_flag;}
friend bool operator==(segment_value_t const& lhs, segment_allocation_failed) { return lhs.array == internal::vector_allocation_error_flag;}
template<typename argument_type>
friend bool operator!=(segment_value_t const& lhs, argument_type arg) { return ! (lhs == arg);}
template<typename T>
T* pointer() const { return static_cast<T*>(const_cast<void*>(array)); }
};
friend void enforce_segment_allocated(segment_value_t const& s, internal::exception_id exception = eid_bad_last_alloc){
if(s != segment_allocated()){
internal::throw_exception(exception);
}
}
// Segment pointer.
class segment_t {
atomic<void*> array;
public:
segment_t(){ store<relaxed>(segment_not_used());}
//Copy ctor and assignment operator are defined to ease using of stl algorithms.
//These algorithms usually not a synchronization point, so, semantic is
//intentionally relaxed here.
segment_t(segment_t const& rhs ){ array.store<relaxed>(rhs.array.load<relaxed>());}
void swap(segment_t & rhs ){
tbb::internal::swap<relaxed>(array, rhs.array);
}
segment_t& operator=(segment_t const& rhs ){
array.store<relaxed>(rhs.array.load<relaxed>());
return *this;
}
template<memory_semantics M>
segment_value_t load() const { return segment_value_t(array.load<M>());}
template<memory_semantics M>
void store(segment_not_used) {
array.store<M>(0);
}
template<memory_semantics M>
void store(segment_allocation_failed) {
__TBB_ASSERT(load<relaxed>() != segment_allocated(),"transition from \"allocated\" to \"allocation failed\" state looks non-logical");
array.store<M>(internal::vector_allocation_error_flag);
}
template<memory_semantics M>
void store(void* allocated_segment_pointer) __TBB_NOEXCEPT(true) {
__TBB_ASSERT(segment_value_t(allocated_segment_pointer) == segment_allocated(),
"other overloads of store should be used for marking segment as not_used or allocation_failed" );
array.store<M>(allocated_segment_pointer);
}
#if TBB_USE_ASSERT
~segment_t() {
__TBB_ASSERT(load<relaxed>() != segment_allocated(), "should have been freed by clear" );
}
#endif /* TBB_USE_ASSERT */
};
friend void swap(segment_t & , segment_t & ) __TBB_NOEXCEPT(true);
// Data fields
void* (*vector_allocator_ptr)(concurrent_vector_base_v3 &, size_t);
atomic<size_type> my_first_block;
atomic<size_type> my_early_size;
atomic<segment_t*> my_segment;
segment_t my_storage[pointers_per_short_table];
// Methods
concurrent_vector_base_v3() {
//Here the semantic is intentionally relaxed.
//The reason this is next:
//Object that is in middle of construction (i.e. its constructor is not yet finished)
//cannot be used concurrently until the construction is finished.
//Thus to flag other threads that construction is finished, some synchronization with
//acquire-release semantic should be done by the (external) code that uses the vector.
//So, no need to do the synchronization inside the vector.
my_early_size.store<relaxed>(0);
my_first_block.store<relaxed>(0); // here is not default_initial_segments
my_segment.store<relaxed>(my_storage);
}
__TBB_EXPORTED_METHOD ~concurrent_vector_base_v3();
//these helpers methods use the fact that segments are allocated so
//that every segment size is a (increasing) power of 2.
//with one exception 0 segment has size of 2 as well segment 1;
//e.g. size of segment with index of 3 is 2^3=8;
static segment_index_t segment_index_of( size_type index ) {
return segment_index_t( __TBB_Log2( index|1 ) );
}
static segment_index_t segment_base( segment_index_t k ) {
return (segment_index_t(1)<<k & ~segment_index_t(1));
}
static inline segment_index_t segment_base_index_of( segment_index_t &index ) {
segment_index_t k = segment_index_of( index );
index -= segment_base(k);
return k;
}
static size_type segment_size( segment_index_t k ) {
return segment_index_t(1)<<k; // fake value for k==0
}
static bool is_first_element_in_segment(size_type element_index){
//check if element_index is a power of 2 that is at least 2.
//The idea is to detect if the iterator crosses a segment boundary,
//and 2 is the minimal index for which it's true
__TBB_ASSERT(element_index, "there should be no need to call "
"is_first_element_in_segment for 0th element" );
return is_power_of_two_at_least( element_index, 2 );
}
typedef void (__TBB_EXPORTED_FUNC *internal_array_op1)(void* begin, size_type n );
typedef void (__TBB_EXPORTED_FUNC *internal_array_op2)(void* dst, const void* src, size_type n );
struct internal_segments_table {
segment_index_t first_block;
segment_t table[pointers_per_long_table];
};
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;
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 );
private:
class helper;
friend class helper;
template<typename Container, typename Value>
friend class vector_iterator;
};
inline void swap(concurrent_vector_base_v3::segment_t & lhs, concurrent_vector_base_v3::segment_t & rhs) __TBB_NOEXCEPT(true) {
lhs.swap(rhs);
}
typedef concurrent_vector_base_v3 concurrent_vector_base;
template<typename Container, typename Value>
class vector_iterator
{
Container* my_vector;
size_t my_index;
mutable Value* my_item;
template<typename C, typename T>
friend vector_iterator<C,T> operator+( ptrdiff_t offset, const vector_iterator<C,T>& v );
template<typename C, typename T, typename U>
friend bool operator==( const vector_iterator<C,T>& i, const vector_iterator<C,U>& j );
template<typename C, typename T, typename U>
friend bool operator<( const vector_iterator<C,T>& i, const vector_iterator<C,U>& j );
template<typename C, typename T, typename U>
friend ptrdiff_t operator-( const vector_iterator<C,T>& i, const vector_iterator<C,U>& j );
template<typename C, typename U>
friend class internal::vector_iterator;
#if !__TBB_TEMPLATE_FRIENDS_BROKEN
template<typename T, class A>
friend class tbb::concurrent_vector;
#else
public:
#endif
vector_iterator( const Container& vector, size_t index, void *ptr = 0 ) :
my_vector(const_cast<Container*>(&vector)),
my_index(index),
my_item(static_cast<Value*>(ptr))
{}
public:
vector_iterator() : my_vector(NULL), my_index(~size_t(0)), my_item(NULL) {}
vector_iterator( const vector_iterator<Container,typename Container::value_type>& other ) :
my_vector(other.my_vector),
my_index(other.my_index),
my_item(other.my_item)
{}
vector_iterator& operator=( const vector_iterator<Container,typename Container::value_type>& other )
{
my_vector=other.my_vector;
my_index=other.my_index;
my_item=other.my_item;
return *this;
}
vector_iterator operator+( ptrdiff_t offset ) const {
return vector_iterator( *my_vector, my_index+offset );
}
vector_iterator &operator+=( ptrdiff_t offset ) {
my_index+=offset;
my_item = NULL;
return *this;
}
vector_iterator operator-( ptrdiff_t offset ) const {
return vector_iterator( *my_vector, my_index-offset );
}
vector_iterator &operator-=( ptrdiff_t offset ) {
my_index-=offset;
my_item = NULL;
return *this;
}
Value& operator*() const {
Value* item = my_item;
if( !item ) {
item = my_item = &my_vector->internal_subscript(my_index);
}
__TBB_ASSERT( item==&my_vector->internal_subscript(my_index), "corrupt cache" );
return *item;
}
Value& operator[]( ptrdiff_t k ) const {
return my_vector->internal_subscript(my_index+k);
}
Value* operator->() const {return &operator*();}
vector_iterator& operator++() {
size_t element_index = ++my_index;
if( my_item ) {
//TODO: consider using of knowledge about "first_block optimization" here as well?
if( concurrent_vector_base::is_first_element_in_segment(element_index)) {
//if the iterator crosses a segment boundary, the pointer become invalid
//as possibly next segment is in another memory location
my_item= NULL;
} else {
++my_item;
}
}
return *this;
}
vector_iterator& operator--() {
__TBB_ASSERT( my_index>0, "operator--() applied to iterator already at beginning of concurrent_vector" );
size_t element_index = my_index--;
if( my_item ) {
if(concurrent_vector_base::is_first_element_in_segment(element_index)) {
//if the iterator crosses a segment boundary, the pointer become invalid
//as possibly next segment is in another memory location
my_item= NULL;
} else {
--my_item;
}
}
return *this;
}
vector_iterator operator++(int) {
vector_iterator result = *this;
operator++();
return result;
}
vector_iterator operator--(int) {
vector_iterator result = *this;
operator--();
return result;
}
// STL support
typedef ptrdiff_t difference_type;
typedef Value value_type;
typedef Value* pointer;
typedef Value& reference;
typedef std::random_access_iterator_tag iterator_category;
};
template<typename Container, typename T>
vector_iterator<Container,T> operator+( ptrdiff_t offset, const vector_iterator<Container,T>& v ) {
return vector_iterator<Container,T>( *v.my_vector, v.my_index+offset );
}
template<typename Container, typename T, typename U>
bool operator==( const vector_iterator<Container,T>& i, const vector_iterator<Container,U>& j ) {
return i.my_index==j.my_index && i.my_vector == j.my_vector;
}
template<typename Container, typename T, typename U>
bool operator!=( const vector_iterator<Container,T>& i, const vector_iterator<Container,U>& j ) {
return !(i==j);
}
template<typename Container, typename T, typename U>
bool operator<( const vector_iterator<Container,T>& i, const vector_iterator<Container,U>& j ) {
return i.my_index<j.my_index;
}
template<typename Container, typename T, typename U>
bool operator>( const vector_iterator<Container,T>& i, const vector_iterator<Container,U>& j ) {
return j<i;
}
template<typename Container, typename T, typename U>
bool operator>=( const vector_iterator<Container,T>& i, const vector_iterator<Container,U>& j ) {
return !(i<j);
}
template<typename Container, typename T, typename U>
bool operator<=( const vector_iterator<Container,T>& i, const vector_iterator<Container,U>& j ) {
return !(j<i);
}
template<typename Container, typename T, typename U>
ptrdiff_t operator-( const vector_iterator<Container,T>& i, const vector_iterator<Container,U>& j ) {
return ptrdiff_t(i.my_index)-ptrdiff_t(j.my_index);
}
template<typename T, class A>
class allocator_base {
public:
typedef typename tbb::internal::allocator_rebind<A, T>::type allocator_type;
allocator_type my_allocator;
allocator_base(const allocator_type &a = allocator_type() ) : my_allocator(a) {}
};
} // namespace internal
template<typename T, class A>
class concurrent_vector: protected internal::allocator_base<T, A>,
private internal::concurrent_vector_base {
private:
template<typename I>
class generic_range_type: public blocked_range<I> {
public:
typedef T value_type;
typedef T& reference;
typedef const T& const_reference;
typedef I iterator;
typedef ptrdiff_t difference_type;
generic_range_type( I begin_, I end_, size_t grainsize_ = 1) : blocked_range<I>(begin_,end_,grainsize_) {}
template<typename U>
generic_range_type( const generic_range_type<U>& r) : blocked_range<I>(r.begin(),r.end(),r.grainsize()) {}
generic_range_type( generic_range_type& r, split ) : blocked_range<I>(r,split()) {}
};
template<typename C, typename U>
friend class internal::vector_iterator;
public:
//------------------------------------------------------------------------
// STL compatible types
//------------------------------------------------------------------------
typedef internal::concurrent_vector_base_v3::size_type size_type;
typedef typename 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;
#if !defined(_MSC_VER) || _CPPLIB_VER>=300
// Assume ISO standard definition of std::reverse_iterator
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
#else
// Use non-standard std::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;
#endif /* defined(_MSC_VER) && (_MSC_VER<1300) */
//------------------------------------------------------------------------
// Parallel algorithm support
//------------------------------------------------------------------------
typedef generic_range_type<iterator> range_type;
typedef generic_range_type<const_iterator> const_range_type;
//------------------------------------------------------------------------
// STL compatible constructors & destructors
//------------------------------------------------------------------------
explicit concurrent_vector(const allocator_type &a = allocator_type())
: internal::allocator_base<T, A>(a), internal::concurrent_vector_base()
{
vector_allocator_ptr = &internal_allocator;
}
//Constructors are not required to have synchronization
//(for more details see comment in the concurrent_vector_base constructor).
#if __TBB_INITIALIZER_LISTS_PRESENT
concurrent_vector(std::initializer_list<T> init_list, const allocator_type &a = allocator_type())
: 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();
}
}
#endif //# __TBB_INITIALIZER_LISTS_PRESENT
concurrent_vector( const concurrent_vector& vector, const allocator_type& a = allocator_type() )
: 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();
}
}
#if __TBB_CPP11_RVALUE_REF_PRESENT
//TODO add __TBB_NOEXCEPT(true) and static_assert(std::has_nothrow_move_constructor<A>::value)
concurrent_vector( concurrent_vector&& source)
: internal::allocator_base<T, A>(std::move(source)), internal::concurrent_vector_base()
{
vector_allocator_ptr = &internal_allocator;
concurrent_vector_base_v3::internal_swap(source);
}
concurrent_vector( concurrent_vector&& source, const allocator_type& a)
: 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();
}
}
}
#endif
template<class M>
__TBB_DEPRECATED concurrent_vector( const concurrent_vector<T, M>& vector, const allocator_type& a = allocator_type() )
: 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();
}
}
explicit concurrent_vector(size_type n)
{
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();
}
}
concurrent_vector(size_type n, const_reference t, const allocator_type& a = allocator_type())
: 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();
}
}
template<class I>
concurrent_vector(I first, I last, const allocator_type &a = allocator_type())
: 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();
}
}
concurrent_vector& operator=( const concurrent_vector& vector ) {
if( this != &vector )
internal_assign(vector, sizeof(T), &destroy_array, &assign_array, &copy_array);
return *this;
}
#if __TBB_CPP11_RVALUE_REF_PRESENT
//TODO: add __TBB_NOEXCEPT()
concurrent_vector& operator=( concurrent_vector&& other ) {
__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;
}
#endif
//TODO: add an template assignment operator? (i.e. with different element type)
template<class M>
__TBB_DEPRECATED concurrent_vector& operator=( const concurrent_vector<T, M>& vector ) {
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;
}
#if __TBB_INITIALIZER_LISTS_PRESENT
concurrent_vector& operator=( std::initializer_list<T> init_list ) {
internal_clear(&destroy_array);
internal_assign_iterators(init_list.begin(), init_list.end());
return *this;
}
#endif //#if __TBB_INITIALIZER_LISTS_PRESENT
//------------------------------------------------------------------------
// Concurrent operations
//------------------------------------------------------------------------
iterator grow_by( size_type delta ) {
return iterator(*this, delta ? internal_grow_by( delta, sizeof(T), &initialize_array, NULL ) : my_early_size.load());
}
iterator grow_by( size_type delta, const_reference t ) {
return iterator(*this, delta ? internal_grow_by( delta, sizeof(T), &initialize_array_by, static_cast<const void*>(&t) ) : my_early_size.load());
}
template<typename I>
iterator grow_by( I first, I last ) {
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());
}
#if __TBB_INITIALIZER_LISTS_PRESENT
iterator grow_by( std::initializer_list<T> init_list ) {
return grow_by( init_list.begin(), init_list.end() );
}
#endif //#if __TBB_INITIALIZER_LISTS_PRESENT
iterator grow_to_at_least( size_type n ) {
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);
};
iterator grow_to_at_least( size_type n, const_reference t ) {
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);
};
iterator push_back( const_reference item )
{
push_back_helper prolog(*this);
new(prolog.internal_push_back_result()) T(item);
return prolog.return_iterator_and_dismiss();
}
#if __TBB_CPP11_RVALUE_REF_PRESENT
iterator push_back( T&& item )
{
push_back_helper prolog(*this);
new(prolog.internal_push_back_result()) T(std::move(item));
return prolog.return_iterator_and_dismiss();
}
#if __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT
template<typename... Args>
iterator emplace_back( Args&&... args )
{
push_back_helper prolog(*this);
new(prolog.internal_push_back_result()) T(std::forward<Args>(args)...);
return prolog.return_iterator_and_dismiss();
}
#endif //__TBB_CPP11_VARIADIC_TEMPLATES_PRESENT
#endif //__TBB_CPP11_RVALUE_REF_PRESENT
reference operator[]( size_type index ) {
return internal_subscript(index);
}
const_reference operator[]( size_type index ) const {
return internal_subscript(index);
}
reference at( size_type index ) {
return internal_subscript_with_exceptions(index);
}
const_reference at( size_type index ) const {
return internal_subscript_with_exceptions(index);
}
range_type range( size_t grainsize = 1 ) {
return range_type( begin(), end(), grainsize );
}
const_range_type range( size_t grainsize = 1 ) const {
return const_range_type( begin(), end(), grainsize );
}
//------------------------------------------------------------------------
// Capacity
//------------------------------------------------------------------------
size_type size() const {
size_type sz = my_early_size, cp = internal_capacity();
return cp < sz ? cp : sz;
}
bool empty() const {return !my_early_size;}
size_type capacity() const {return internal_capacity();}
void reserve( size_type n ) {
if( n )
internal_reserve(n, sizeof(T), max_size());
}
void resize( size_type n ) {
internal_resize( n, sizeof(T), max_size(), NULL, &destroy_array, &initialize_array );
}
void resize( size_type n, const_reference t ) {
internal_resize( n, sizeof(T), max_size(), static_cast<const void*>(&t), &destroy_array, &initialize_array_by );
}
void shrink_to_fit();
size_type max_size() const {return (~size_type(0))/sizeof(T);}
//------------------------------------------------------------------------
// STL support
//------------------------------------------------------------------------
iterator begin() {return iterator(*this,0);}
iterator end() {return iterator(*this,size());}
const_iterator begin() const {return const_iterator(*this,0);}
const_iterator end() const {return const_iterator(*this,size());}
const_iterator cbegin() const {return const_iterator(*this,0);}
const_iterator cend() const {return const_iterator(*this,size());}
reverse_iterator rbegin() {return reverse_iterator(end());}
reverse_iterator rend() {return reverse_iterator(begin());}
const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
const_reverse_iterator crbegin() const {return const_reverse_iterator(end());}
const_reverse_iterator crend() const {return const_reverse_iterator(begin());}
reference front() {
__TBB_ASSERT( size()>0, NULL);
const segment_value_t& segment_value = my_segment[0].template load<relaxed>();
return (segment_value.template pointer<T>())[0];
}
const_reference front() const {
__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];
}
reference back() {
__TBB_ASSERT( size()>0, NULL);
return internal_subscript( size()-1 );
}
const_reference back() const {
__TBB_ASSERT( size()>0, NULL);
return internal_subscript( size()-1 );
}
allocator_type get_allocator() const { return this->my_allocator; }
void assign(size_type n, const_reference t) {
clear();
internal_resize( n, sizeof(T), max_size(), static_cast<const void*>(&t), &destroy_array, &initialize_array_by );
}
template<class I>
void assign(I first, I last) {
clear(); internal_assign_range( first, last, static_cast<is_integer_tag<std::numeric_limits<I>::is_integer> *>(0) );
}
#if __TBB_INITIALIZER_LISTS_PRESENT
void assign(std::initializer_list<T> init_list) {
clear(); internal_assign_iterators( init_list.begin(), init_list.end());
}
#endif //# __TBB_INITIALIZER_LISTS_PRESENT
void swap(concurrent_vector &vector) {
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());
}
}
void clear() {
internal_clear(&destroy_array);
}
~concurrent_vector() {
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
}
const internal::concurrent_vector_base_v3 &internal_vector_base() const { return *this; }
private:
static void *internal_allocator(internal::concurrent_vector_base_v3 &vb, size_t k) {
return static_cast<concurrent_vector<T, A>&>(vb).my_allocator.allocate(k);
}
void internal_free_segments(segment_t table[], segment_index_t k, segment_index_t first_block);
T& internal_subscript( size_type index ) const;
T& internal_subscript_with_exceptions( size_type index ) const;
void internal_assign_n(size_type n, const_pointer p) {
internal_resize( n, sizeof(T), max_size(), static_cast<const void*>(p), &destroy_array, p? &initialize_array_by : &initialize_array );
}
/* Functions declarations:
* void foo(is_integer_tag<true>*);
* void foo(is_integer_tag<false>*);
* Usage example:
* foo(static_cast<is_integer_tag<std::numeric_limits<T>::is_integer>*>(0));
*/
template<bool B> class is_integer_tag;
template<class I>
void internal_assign_range(I first, I last, is_integer_tag<true> *) {
internal_assign_n(static_cast<size_type>(first), &static_cast<T&>(last));
}
template<class I>
void internal_assign_range(I first, I last, is_integer_tag<false> *) {
internal_assign_iterators(first, last);
}
template<class I>
void internal_assign_iterators(I first, I last);
//these functions are marked __TBB_EXPORTED_FUNC as they are called from within the library
static void __TBB_EXPORTED_FUNC initialize_array( void* begin, const void*, size_type n );
static void __TBB_EXPORTED_FUNC initialize_array_by( void* begin, const void* src, size_type n );
static void __TBB_EXPORTED_FUNC copy_array( void* dst, const void* src, size_type n );
#if __TBB_MOVE_IF_NOEXCEPT_PRESENT
static void __TBB_EXPORTED_FUNC move_array_if_noexcept( void* dst, const void* src, size_type n );
#endif //__TBB_MOVE_IF_NO_EXCEPT_PRESENT
#if __TBB_CPP11_RVALUE_REF_PRESENT
static void __TBB_EXPORTED_FUNC move_array( void* dst, const void* src, size_type n );
static void __TBB_EXPORTED_FUNC move_assign_array( void* dst, const void* src, size_type n );
#endif
template<typename Iterator>
static void __TBB_EXPORTED_FUNC copy_range( void* dst, const void* p_type_erased_iterator, size_type n );
static void __TBB_EXPORTED_FUNC assign_array( void* dst, const void* src, size_type n );
static void __TBB_EXPORTED_FUNC destroy_array( void* begin, size_type n );
class internal_loop_guide : internal::no_copy {
public:
const pointer array;
const size_type n;
size_type i;
static const T* as_const_pointer(const void *ptr) { return static_cast<const T *>(ptr); }
static T* as_pointer(const void *src) { return static_cast<T*>(const_cast<void *>(src)); }
internal_loop_guide(size_type ntrials, void *ptr)
: array(as_pointer(ptr)), n(ntrials), i(0) {}
void init() { for(; i < n; ++i) new( &array[i] ) T(); }
void init(const void *src) { for(; i < n; ++i) new( &array[i] ) T(*as_const_pointer(src)); }
void copy(const void *src) { for(; i < n; ++i) new( &array[i] ) T(as_const_pointer(src)[i]); }
void assign(const void *src) { for(; i < n; ++i) array[i] = as_const_pointer(src)[i]; }
#if __TBB_CPP11_RVALUE_REF_PRESENT
void move_assign(const void *src) { for(; i < n; ++i) array[i] = std::move(as_pointer(src)[i]); }
void move_construct(const void *src) { for(; i < n; ++i) new( &array[i] ) T( std::move(as_pointer(src)[i]) ); }
#endif
#if __TBB_MOVE_IF_NOEXCEPT_PRESENT
void move_construct_if_noexcept(const void *src) { for(; i < n; ++i) new( &array[i] ) T( std::move_if_noexcept(as_pointer(src)[i]) ); }
#endif //__TBB_MOVE_IF_NOEXCEPT_PRESENT
//TODO: rename to construct_range
template<class I> void iterate(I &src) { for(; i < n; ++i, ++src) new( &array[i] ) T( *src ); }
~internal_loop_guide() {
if(i < n) {// if an exception was raised, fill the rest of items with zeros
internal::handle_unconstructed_elements(array+i, n-i);
}
}
};
struct push_back_helper : internal::no_copy{
struct element_construction_guard : internal::no_copy{
pointer element;
element_construction_guard(pointer an_element) : element (an_element){}
void dismiss(){ element = NULL; }
~element_construction_guard(){
if (element){
internal::handle_unconstructed_elements(element, 1);
}
}
};
concurrent_vector & v;
size_type k;
element_construction_guard g;
push_back_helper(concurrent_vector & vector) :
v(vector),
g (static_cast<T*>(v.internal_push_back(sizeof(T),k)))
{}
pointer internal_push_back_result(){ return g.element;}
iterator return_iterator_and_dismiss(){
pointer ptr = g.element;
g.dismiss();
return iterator(v, k, ptr);
}
};
};
#if __TBB_CPP17_DEDUCTION_GUIDES_PRESENT
// Deduction guide for the constructor from two iterators
template<typename I,
typename T = typename std::iterator_traits<I>::value_type,
typename A = cache_aligned_allocator<T>
> concurrent_vector(I, I, const A& = A())
-> concurrent_vector<T, A>;
// Deduction guide for the constructor from a vector and allocator
template<typename T, typename A1, typename A2>
concurrent_vector(const concurrent_vector<T, A1> &, const A2 &)
-> concurrent_vector<T, A2>;
// Deduction guide for the constructor from an initializer_list
template<typename T, typename A = cache_aligned_allocator<T>
> concurrent_vector(std::initializer_list<T>, const A& = A())
-> concurrent_vector<T, A>;
#endif /* __TBB_CPP17_DEDUCTION_GUIDES_PRESENT */
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
#pragma warning (push)
#pragma warning (disable: 4701) // potentially uninitialized local variable "old"
#endif
template<typename T, class A>
void concurrent_vector<T, A>::shrink_to_fit() {
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();
}
}
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
#pragma warning (pop)
#endif // warning 4701 is back
template<typename T, class A>
void concurrent_vector<T, A>::internal_free_segments(segment_t table[], segment_index_t k, segment_index_t first_block) {
// 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) );
}
}
template<typename T, class A>
T& concurrent_vector<T, A>::internal_subscript( size_type index ) const {
//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];
}
template<typename T, class A>
T& concurrent_vector<T, A>::internal_subscript_with_exceptions( size_type index ) const {
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];
}
template<typename T, class A> template<class I>
void concurrent_vector<T, A>::internal_assign_iterators(I first, I last) {
__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);
}
template<typename T, class A>
void concurrent_vector<T, A>::initialize_array( void* begin, const void *, size_type n ) {
internal_loop_guide loop(n, begin); loop.init();
}
template<typename T, class A>
void concurrent_vector<T, A>::initialize_array_by( void* begin, const void *src, size_type n ) {
internal_loop_guide loop(n, begin); loop.init(src);
}
template<typename T, class A>
void concurrent_vector<T, A>::copy_array( void* dst, const void* src, size_type n ) {
internal_loop_guide loop(n, dst); loop.copy(src);
}
#if __TBB_CPP11_RVALUE_REF_PRESENT
template<typename T, class A>
void concurrent_vector<T, A>::move_array( void* dst, const void* src, size_type n ) {
internal_loop_guide loop(n, dst); loop.move_construct(src);
}
template<typename T, class A>
void concurrent_vector<T, A>::move_assign_array( void* dst, const void* src, size_type n ) {
internal_loop_guide loop(n, dst); loop.move_assign(src);
}
#endif
#if __TBB_MOVE_IF_NOEXCEPT_PRESENT
template<typename T, class A>
void concurrent_vector<T, A>::move_array_if_noexcept( void* dst, const void* src, size_type n ) {
internal_loop_guide loop(n, dst); loop.move_construct_if_noexcept(src);
}
#endif //__TBB_MOVE_IF_NOEXCEPT_PRESENT
template<typename T, class A>
template<typename I>
void concurrent_vector<T, A>::copy_range( void* dst, const void* p_type_erased_iterator, size_type n ){
internal_loop_guide loop(n, dst);
loop.iterate( *(static_cast<I*>(const_cast<void*>(p_type_erased_iterator))) );
}
template<typename T, class A>
void concurrent_vector<T, A>::assign_array( void* dst, const void* src, size_type n ) {
internal_loop_guide loop(n, dst); loop.assign(src);
}
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
// Workaround for overzealous compiler warning
#pragma warning (push)
#pragma warning (disable: 4189)
#endif
template<typename T, class A>
void concurrent_vector<T, A>::destroy_array( void* begin, size_type n ) {
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
}
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
#pragma warning (pop)
#endif // warning 4189 is back
// concurrent_vector's template functions
template<typename T, class A1, class A2>
inline bool operator==(const concurrent_vector<T, A1> &a, const concurrent_vector<T, A2> &b) {
//TODO: call size() only once per vector (in operator==)
// Simply: return a.size() == b.size() && std::equal(a.begin(), a.end(), b.begin());
if(a.size() != b.size()) return false;
typename concurrent_vector<T, A1>::const_iterator i(a.begin());
typename concurrent_vector<T, A2>::const_iterator j(b.begin());
for(; i != a.end(); ++i, ++j)
if( !(*i == *j) ) return false;
return true;
}
template<typename T, class A1, class A2>
inline bool operator!=(const concurrent_vector<T, A1> &a, const concurrent_vector<T, A2> &b)
{ return !(a == b); }
template<typename T, class A1, class A2>
inline bool operator<(const concurrent_vector<T, A1> &a, const concurrent_vector<T, A2> &b)
{ return (std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end())); }
template<typename T, class A1, class A2>
inline bool operator>(const concurrent_vector<T, A1> &a, const concurrent_vector<T, A2> &b)
{ return b < a; }
template<typename T, class A1, class A2>
inline bool operator<=(const concurrent_vector<T, A1> &a, const concurrent_vector<T, A2> &b)
{ return !(b < a); }
template<typename T, class A1, class A2>
inline bool operator>=(const concurrent_vector<T, A1> &a, const concurrent_vector<T, A2> &b)
{ return !(a < b); }
template<typename T, class A>
inline void swap(concurrent_vector<T, A> &a, concurrent_vector<T, A> &b)
{ a.swap( b ); }
} // namespace tbb
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
#pragma warning (pop)
#endif // warning 4267,4127 are back
#undef __TBB_concurrent_vector_H_include_area
#include "internal/_warning_suppress_disable_notice.h"
#endif /* __TBB_concurrent_vector_H */
atomic.h
blocked_range.h
cache_aligned_allocator.h
_allocator_traits.h
_warning_suppress_disable_notice.h
_warning_suppress_enable_notice.h
__TBB_EXPORTED_FUNC
#define __TBB_EXPORTED_FUNC
Definition: scalable_allocator.h:38
__TBB_DEPRECATED
#define __TBB_DEPRECATED
Definition: tbb_config.h:637
tbb_exception.h
tbb_machine.h
__TBB_Log2
intptr_t __TBB_Log2(uintptr_t x)
Definition: tbb_machine.h:863
tbb_profiling.h
tbb_stddef.h
__TBB_CATCH
#define __TBB_CATCH(e)
Definition: tbb_stddef.h:284
__TBB_NOEXCEPT
#define __TBB_NOEXCEPT(expression)
Definition: tbb_stddef.h:110
__TBB_TRY
#define __TBB_TRY
Definition: tbb_stddef.h:283
__TBB_EXPORTED_METHOD
#define __TBB_EXPORTED_METHOD
Definition: tbb_stddef.h:98
__TBB_ASSERT
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
__TBB_RETHROW
#define __TBB_RETHROW()
Definition: tbb_stddef.h:286
s
void const char const char int ITT_FORMAT __itt_group_sync s
Definition: ittnotify_static.h:91
new_size
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 new_size
Definition: ittnotify_static.h:163
begin
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 begin
Definition: ittnotify_static.h:182
void
void
Definition: ittnotify_static.h:91
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
p
void const char const char int ITT_FORMAT __itt_group_sync p
Definition: ittnotify_static.h:91
tbb
The graph class.
Definition: serial/tbb/parallel_for.h:46
tbb::operator<
bool operator<(const concurrent_vector< T, A1 > &a, const concurrent_vector< T, A2 > &b)
Definition: concurrent_vector.h:1367
tbb::swap
void swap(concurrent_hash_map< Key, T, HashCompare, A > &a, concurrent_hash_map< Key, T, HashCompare, A > &b)
Definition: concurrent_hash_map.h:1638
tbb::operator==
bool operator==(const cache_aligned_allocator< T > &, const cache_aligned_allocator< U > &)
Definition: cache_aligned_allocator.h:129
tbb::operator>
bool operator>(const concurrent_vector< T, A1 > &a, const concurrent_vector< T, A2 > &b)
Definition: concurrent_vector.h:1371
tbb::operator>=
bool operator>=(const concurrent_vector< T, A1 > &a, const concurrent_vector< T, A2 > &b)
Definition: concurrent_vector.h:1379
tbb::move
void move(tbb_thread &t1, tbb_thread &t2)
Definition: tbb_thread.h:319
tbb::operator<=
bool operator<=(const concurrent_vector< T, A1 > &a, const concurrent_vector< T, A2 > &b)
Definition: concurrent_vector.h:1375
tbb::relaxed
@ relaxed
No ordering.
Definition: atomic.h:61
tbb::acquire
@ acquire
Acquire.
Definition: atomic.h:57
tbb::operator!=
bool operator!=(const cache_aligned_allocator< T > &, const cache_aligned_allocator< U > &)
Definition: cache_aligned_allocator.h:132
tbb::internal::operator>=
bool operator>=(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
Definition: concurrent_vector.h:462
tbb::internal::allocator_swap
void allocator_swap(MyAlloc &my_allocator, OtherAlloc &other_allocator, traits_true_type)
Definition: _allocator_traits.h:69
tbb::internal::vector_allocation_error_flag
static void *const vector_allocation_error_flag
Bad allocation marker.
Definition: concurrent_vector.h:73
tbb::internal::swap
void swap(atomic< T > &lhs, atomic< T > &rhs)
Definition: atomic.h:564
tbb::internal::operator!=
bool operator!=(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
Definition: concurrent_vector.h:447
tbb::internal::handle_unconstructed_elements
void handle_unconstructed_elements(T *array, size_t n_of_elements)
Exception helper function.
Definition: concurrent_vector.h:77
tbb::internal::operator==
bool operator==(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
Definition: concurrent_vector.h:442
tbb::internal::allocator_move_assignment
void allocator_move_assignment(MyAlloc &my_allocator, OtherAlloc &other_allocator, traits_true_type)
Definition: _allocator_traits.h:59
tbb::internal::operator<=
bool operator<=(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
Definition: concurrent_vector.h:467
tbb::internal::operator-
ptrdiff_t operator-(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
Definition: concurrent_vector.h:472
tbb::internal::throw_exception
void throw_exception(exception_id eid)
Versionless convenience wrapper for throw_exception_v4()
Definition: tbb_exception.h:105
tbb::internal::operator>
bool operator>(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
Definition: concurrent_vector.h:457
tbb::internal::concurrent_vector_base
concurrent_vector_base_v3 concurrent_vector_base
Definition: concurrent_vector.h:288
tbb::internal::last
auto last(Container &c) -> decltype(begin(c))
Definition: _range_iterator.h:40
tbb::internal::exception_id
exception_id
Definition: tbb_exception.h:67
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_bad_last_alloc
@ eid_bad_last_alloc
Definition: tbb_exception.h:69
tbb::internal::eid_index_range_error
@ eid_index_range_error
Definition: tbb_exception.h:73
tbb::internal::first
auto first(Container &c) -> decltype(begin(c))
Definition: _range_iterator.h:34
tbb::internal::operator+
vector_iterator< Container, T > operator+(ptrdiff_t offset, const vector_iterator< Container, T > &v)
Definition: concurrent_vector.h:437
tbb::internal::operator<
bool operator<(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
Definition: concurrent_vector.h:452
tbb::internal::is_power_of_two_at_least
bool is_power_of_two_at_least(argument_integer_type arg, power2_integer_type power2)
A function to determine if arg is a power of 2 at least as big as another power of 2.
Definition: tbb_stddef.h:392
internal
Definition: _flow_graph_async_msg_impl.h:24
tbb::blocked_range
A range over which to iterate.
Definition: blocked_range.h:45
tbb::blocked_range< I >::begin
const_iterator begin() const
Beginning of range.
Definition: blocked_range.h:69
tbb::blocked_range< I >::grainsize
size_type grainsize() const
The grain size for this range.
Definition: blocked_range.h:82
tbb::blocked_range< I >::end
const_iterator end() const
One past last value in range.
Definition: blocked_range.h:72
tbb::concurrent_vector
Concurrent vector container.
Definition: concurrent_vector.h:551
tbb::concurrent_vector::concurrent_vector
concurrent_vector(const concurrent_vector &vector, const allocator_type &a=allocator_type())
Copying constructor.
Definition: concurrent_vector.h:634
tbb::concurrent_vector::reserve
void reserve(size_type n)
Allocate enough space to grow to size n without having to allocate more memory later.
Definition: concurrent_vector.h:914
tbb::concurrent_vector::crbegin
const_reverse_iterator crbegin() const
reverse start const iterator
Definition: concurrent_vector.h:960
tbb::concurrent_vector::operator=
concurrent_vector & operator=(concurrent_vector &&other)
Move assignment.
Definition: concurrent_vector.h:745
tbb::concurrent_vector::internal_assign_range
void internal_assign_range(I first, I last, is_integer_tag< false > *)
inline proxy assign by iterators
Definition: concurrent_vector.h:1065
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::const_range_type
generic_range_type< const_iterator > const_range_type
Definition: concurrent_vector.h:601
tbb::concurrent_vector::reverse_iterator
std::reverse_iterator< iterator > reverse_iterator
Definition: concurrent_vector.h:589
tbb::concurrent_vector::end
const_iterator end() const
end const iterator
Definition: concurrent_vector.h:946
tbb::concurrent_vector::front
const_reference front() const
the first item const
Definition: concurrent_vector.h:970
tbb::concurrent_vector::difference_type
ptrdiff_t difference_type
Definition: concurrent_vector.h:578
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
tbb::concurrent_vector::operator[]
reference operator[](size_type index)
Get reference to element at given index.
Definition: concurrent_vector.h:867
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::rend
const_reverse_iterator rend() const
reverse end const iterator
Definition: concurrent_vector.h:958
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
tbb::concurrent_vector::get_allocator
allocator_type get_allocator() const
return allocator object
Definition: concurrent_vector.h:986
tbb::concurrent_vector::back
const_reference back() const
the last item const
Definition: concurrent_vector.h:981
tbb::concurrent_vector::reference
T & reference
Definition: concurrent_vector.h:579
tbb::concurrent_vector::grow_to_at_least
iterator grow_to_at_least(size_type n, const_reference t)
Definition: concurrent_vector.h:825
tbb::concurrent_vector::range_type
generic_range_type< iterator > range_type
Definition: concurrent_vector.h:600
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::iterator
internal::vector_iterator< concurrent_vector, T > iterator
Definition: concurrent_vector.h:584
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
tbb::concurrent_vector::clear
void clear()
Clear container while keeping memory allocated.
Definition: concurrent_vector.h:1018
tbb::concurrent_vector::at
const_reference at(size_type index) const
Get const reference to element at given index. Throws exceptions on errors.
Definition: concurrent_vector.h:882
tbb::concurrent_vector::assign
void assign(std::initializer_list< T > init_list)
assigns an initializer list
Definition: concurrent_vector.h:1002
tbb::concurrent_vector::concurrent_vector
concurrent_vector(const allocator_type &a=allocator_type())
Construct empty vector.
Definition: concurrent_vector.h:608
tbb::concurrent_vector::cend
const_iterator cend() const
end const iterator
Definition: concurrent_vector.h:950
tbb::concurrent_vector::value_type
T value_type
Definition: concurrent_vector.h:577
tbb::concurrent_vector::const_reference
const T & const_reference
Definition: concurrent_vector.h:580
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
tbb::concurrent_vector::rend
reverse_iterator rend()
reverse end iterator
Definition: concurrent_vector.h:954
tbb::concurrent_vector::at
reference at(size_type index)
Get reference to element at given index. Throws exceptions on errors.
Definition: concurrent_vector.h:877
tbb::concurrent_vector::resize
void resize(size_type n)
Resize the vector. Not thread-safe.
Definition: concurrent_vector.h:920
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::concurrent_vector
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,...
Definition: concurrent_vector.h:707
tbb::concurrent_vector::allocator_type
internal::allocator_base< T, A >::allocator_type allocator_type
Definition: concurrent_vector.h:575
tbb::concurrent_vector::cbegin
const_iterator cbegin() const
start const iterator
Definition: concurrent_vector.h:948
tbb::concurrent_vector::assign
void assign(I first, I last)
assign range [first, last)
Definition: concurrent_vector.h:996
tbb::concurrent_vector::empty
bool empty() const
Return false if vector is not empty or has elements under construction at least.
Definition: concurrent_vector.h:906
tbb::concurrent_vector::range
range_type range(size_t grainsize=1)
Get range for iterating with parallel algorithms.
Definition: concurrent_vector.h:887
tbb::concurrent_vector::operator=
__TBB_DEPRECATED concurrent_vector & operator=(const concurrent_vector< T, M > &vector)
Assignment for vector with different allocator type.
Definition: concurrent_vector.h:762
tbb::concurrent_vector::operator=
concurrent_vector & operator=(std::initializer_list< T > init_list)
Assignment for initializer_list.
Definition: concurrent_vector.h:771
tbb::concurrent_vector::copy_range
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,...
tbb::concurrent_vector::swap
void swap(concurrent_vector &vector)
swap two instances
Definition: concurrent_vector.h:1008
tbb::concurrent_vector::assign
void assign(size_type n, const_reference t)
assign n items by copying t item
Definition: concurrent_vector.h:989
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
tbb::concurrent_vector::crend
const_reverse_iterator crend() const
reverse end const iterator
Definition: concurrent_vector.h:962
tbb::concurrent_vector::operator=
concurrent_vector & operator=(const concurrent_vector &vector)
Assignment.
Definition: concurrent_vector.h:736
tbb::concurrent_vector::resize
void resize(size_type n, const_reference t)
Resize the vector, copy t for new elements. Not thread-safe.
Definition: concurrent_vector.h:925
tbb::concurrent_vector::grow_by
iterator grow_by(std::initializer_list< T > init_list)
Definition: concurrent_vector.h:804
tbb::concurrent_vector::emplace_back
iterator emplace_back(Args &&... args)
Push item, create item "in place" with provided arguments.
Definition: concurrent_vector.h:856
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::concurrent_vector::rbegin
reverse_iterator rbegin()
reverse start iterator
Definition: concurrent_vector.h:952
tbb::concurrent_vector::front
reference front()
the first item
Definition: concurrent_vector.h:964
tbb::concurrent_vector::range
const_range_type range(size_t grainsize=1) const
Get const range for iterating with parallel algorithms.
Definition: concurrent_vector.h:892
tbb::concurrent_vector::grow_by
iterator grow_by(size_type delta, const_reference t)
Grow by "delta" elements using copying constructor.
Definition: concurrent_vector.h:789
tbb::concurrent_vector::concurrent_vector
concurrent_vector(std::initializer_list< T > init_list, const allocator_type &a=allocator_type())
Constructor from initializer_list.
Definition: concurrent_vector.h:618
tbb::concurrent_vector::pointer
T * pointer
Definition: concurrent_vector.h:581
tbb::concurrent_vector::concurrent_vector
__TBB_DEPRECATED concurrent_vector(const concurrent_vector< T, M > &vector, const allocator_type &a=allocator_type())
Copying constructor for vector with different allocator type.
Definition: concurrent_vector.h:680
tbb::concurrent_vector::concurrent_vector
concurrent_vector(size_type n)
Construction with initial size specified by argument n.
Definition: concurrent_vector.h:694
tbb::concurrent_vector::rbegin
const_reverse_iterator rbegin() const
reverse start const iterator
Definition: concurrent_vector.h:956
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::concurrent_vector::const_iterator
internal::vector_iterator< concurrent_vector, const T > const_iterator
Definition: concurrent_vector.h:585
tbb::concurrent_vector::end
iterator end()
end iterator
Definition: concurrent_vector.h:942
tbb::concurrent_vector::back
reference back()
the last item
Definition: concurrent_vector.h:976
tbb::concurrent_vector::concurrent_vector
concurrent_vector(concurrent_vector &&source)
Move constructor.
Definition: concurrent_vector.h:650
tbb::concurrent_vector::operator[]
const_reference operator[](size_type index) const
Get const reference to element at given index.
Definition: concurrent_vector.h:872
tbb::concurrent_vector::begin
iterator begin()
start iterator
Definition: concurrent_vector.h:940
tbb::concurrent_vector::internal_subscript
T & internal_subscript(size_type index) const
Get reference to element at given index.
Definition: concurrent_vector.h:1234
tbb::concurrent_vector::~concurrent_vector
~concurrent_vector()
Clear and destroy vector.
Definition: concurrent_vector.h:1023
tbb::concurrent_vector::grow_by
iterator grow_by(size_type delta)
Grow by "delta" elements.
Definition: concurrent_vector.h:783
tbb::concurrent_vector::internal_vector_base
const internal::concurrent_vector_base_v3 & internal_vector_base() const
Definition: concurrent_vector.h:1029
tbb::concurrent_vector::shrink_to_fit
void shrink_to_fit()
Optimize memory usage and fragmentation.
Definition: concurrent_vector.h:1193
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
tbb::concurrent_vector::capacity
size_type capacity() const
Maximum size to which array can grow without allocating more memory. Concurrent allocations are not i...
Definition: concurrent_vector.h:909
tbb::concurrent_vector::push_back
iterator push_back(T &&item)
Push item, move-aware.
Definition: concurrent_vector.h:846
tbb::concurrent_vector::begin
const_iterator begin() const
start const iterator
Definition: concurrent_vector.h:944
tbb::concurrent_vector::grow_by
iterator grow_by(I first, I last)
Definition: concurrent_vector.h:795
tbb::concurrent_vector::max_size
size_type max_size() const
Upper bound on argument to reserve.
Definition: concurrent_vector.h:933
tbb::concurrent_vector::push_back
iterator push_back(const_reference item)
Push item.
Definition: concurrent_vector.h:836
tbb::concurrent_vector::size_type
internal::concurrent_vector_base_v3::size_type size_type
Definition: concurrent_vector.h:574
tbb::concurrent_vector::const_reverse_iterator
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: concurrent_vector.h:590
tbb::concurrent_vector::concurrent_vector
concurrent_vector(I first, I last, const allocator_type &a=allocator_type())
Construction with copying iteration range and given allocator instance.
Definition: concurrent_vector.h:722
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::concurrent_vector::grow_to_at_least
iterator grow_to_at_least(size_type n)
Append minimal sequence of elements such that size()>=n.
Definition: concurrent_vector.h:814
tbb::concurrent_vector::internal_assign_iterators
void internal_assign_iterators(I first, I last)
assign by iterators
Definition: concurrent_vector.h:1269
tbb::concurrent_vector::concurrent_vector
concurrent_vector(concurrent_vector &&source, const allocator_type &a)
Definition: concurrent_vector.h:657
tbb::concurrent_vector::const_pointer
const T * const_pointer
Definition: concurrent_vector.h:582
tbb::internal::vector_iterator
Meets requirements of a forward iterator for STL and a Value for a blocked_range.*‍/.
Definition: concurrent_vector.h:295
tbb::internal::vector_iterator::reference
Value & reference
Definition: concurrent_vector.h:432
tbb::internal::vector_iterator::value_type
Value value_type
Definition: concurrent_vector.h:430
tbb::internal::vector_iterator::operator++
vector_iterator operator++(int)
Post increment.
Definition: concurrent_vector.h:414
tbb::internal::vector_iterator::operator--
vector_iterator operator--(int)
Post decrement.
Definition: concurrent_vector.h:421
tbb::internal::vector_iterator::operator=
vector_iterator & operator=(const vector_iterator< Container, typename Container::value_type > &other)
Definition: concurrent_vector.h:344
tbb::internal::vector_iterator::operator+
friend vector_iterator< C, T > operator+(ptrdiff_t offset, const vector_iterator< C, T > &v)
tbb::internal::vector_iterator::operator->
Value * operator->() const
Definition: concurrent_vector.h:379
tbb::internal::vector_iterator::operator*
Value & operator*() const
Definition: concurrent_vector.h:368
tbb::internal::vector_iterator::my_item
Value * my_item
Caches my_vector->internal_subscript(my_index)
Definition: concurrent_vector.h:304
tbb::internal::vector_iterator::operator+
vector_iterator operator+(ptrdiff_t offset) const
Definition: concurrent_vector.h:352
tbb::internal::vector_iterator::vector_iterator
vector_iterator()
Default constructor.
Definition: concurrent_vector.h:336
tbb::internal::vector_iterator::operator+=
vector_iterator & operator+=(ptrdiff_t offset)
Definition: concurrent_vector.h:355
tbb::internal::vector_iterator::operator--
vector_iterator & operator--()
Pre decrement.
Definition: concurrent_vector.h:398
tbb::internal::vector_iterator::vector_iterator
vector_iterator(const vector_iterator< Container, typename Container::value_type > &other)
Definition: concurrent_vector.h:338
tbb::internal::vector_iterator::operator==
friend bool operator==(const vector_iterator< C, T > &i, const vector_iterator< C, U > &j)
tbb::internal::vector_iterator::iterator_category
std::random_access_iterator_tag iterator_category
Definition: concurrent_vector.h:433
tbb::internal::vector_iterator::operator<
friend bool operator<(const vector_iterator< C, T > &i, const vector_iterator< C, U > &j)
tbb::internal::vector_iterator::difference_type
ptrdiff_t difference_type
Definition: concurrent_vector.h:429
tbb::internal::vector_iterator::operator++
vector_iterator & operator++()
Pre increment.
Definition: concurrent_vector.h:382
tbb::internal::vector_iterator::pointer
Value * pointer
Definition: concurrent_vector.h:431
tbb::internal::vector_iterator::operator-
vector_iterator operator-(ptrdiff_t offset) const
Definition: concurrent_vector.h:360
tbb::internal::vector_iterator::my_index
size_t my_index
Index into the vector.
Definition: concurrent_vector.h:300
tbb::internal::vector_iterator::my_vector
Container * my_vector
concurrent_vector over which we are iterating.
Definition: concurrent_vector.h:297
tbb::internal::vector_iterator::operator-
friend ptrdiff_t operator-(const vector_iterator< C, T > &i, const vector_iterator< C, U > &j)
tbb::internal::vector_iterator::operator[]
Value & operator[](ptrdiff_t k) const
Definition: concurrent_vector.h:376
tbb::internal::vector_iterator::vector_iterator
vector_iterator(const Container &vector, size_t index, void *ptr=0)
Definition: concurrent_vector.h:328
tbb::internal::vector_iterator::operator-=
vector_iterator & operator-=(ptrdiff_t offset)
Definition: concurrent_vector.h:363
tbb::internal::concurrent_vector_base_v3
Base class of concurrent vector implementation.
Definition: concurrent_vector.h:83
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_throw_exception
void __TBB_EXPORTED_METHOD internal_throw_exception(size_type) const
Obsolete.
Definition: concurrent_vector.cpp:333
tbb::internal::concurrent_vector_base_v3::size_type
size_t size_type
Definition: concurrent_vector.h:88
tbb::internal::concurrent_vector_base_v3::segment_index_of
static segment_index_t segment_index_of(size_type index)
Definition: concurrent_vector.h:214
tbb::internal::concurrent_vector_base_v3::my_early_size
atomic< size_type > my_early_size
Requested size of vector.
Definition: concurrent_vector.h:184
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
tbb::internal::concurrent_vector_base_v3::is_first_element_in_segment
static bool is_first_element_in_segment(size_type element_index)
Definition: concurrent_vector.h:233
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::concurrent_vector_base_v3::swap
friend void swap(segment_t &, segment_t &) __TBB_NOEXCEPT(true)
Definition: concurrent_vector.h:284
tbb::internal::concurrent_vector_base_v3::internal_push_back
void *__TBB_EXPORTED_METHOD internal_push_back(size_type element_size, size_type &index)
Definition: concurrent_vector.cpp:418
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::segment_index_t
size_t segment_index_t
Definition: concurrent_vector.h:87
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
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
tbb::internal::concurrent_vector_base_v3::internal_swap
void __TBB_EXPORTED_METHOD internal_swap(concurrent_vector_base_v3 &v)
Definition: concurrent_vector.cpp:582
tbb::internal::concurrent_vector_base_v3::internal_grow
void internal_grow(size_type start, size_type finish, size_type element_size, internal_array_op2 init, const void *src)
Definition: concurrent_vector.cpp:473
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::concurrent_vector_base_v3
concurrent_vector_base_v3()
Definition: concurrent_vector.h:194
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
tbb::internal::concurrent_vector_base_v3::segment_base
static segment_index_t segment_base(segment_index_t k)
Definition: concurrent_vector.h:218
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::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::pointers_per_long_table
@ pointers_per_long_table
Definition: concurrent_vector.h:96
tbb::internal::concurrent_vector_base_v3::default_initial_segments
@ default_initial_segments
Definition: concurrent_vector.h:93
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_segment
atomic< segment_t * > my_segment
Pointer to the segments table.
Definition: concurrent_vector.h:187
tbb::internal::concurrent_vector_base_v3::~concurrent_vector_base_v3
__TBB_EXPORTED_METHOD ~concurrent_vector_base_v3()
Definition: concurrent_vector.cpp:313
tbb::internal::concurrent_vector_base_v3::internal_array_op1
void(__TBB_EXPORTED_FUNC * internal_array_op1)(void *begin, size_type n)
An operation on an n-element array starting at begin.
Definition: concurrent_vector.h:243
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
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
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
tbb::internal::concurrent_vector_base_v3::internal_capacity
size_type __TBB_EXPORTED_METHOD internal_capacity() const
Definition: concurrent_vector.cpp:329
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
tbb::internal::concurrent_vector_base_v3::internal_grow_to_at_least
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.
Definition: concurrent_vector.cpp:430
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
tbb::internal::concurrent_vector_base_v3::segment_not_used
Definition: concurrent_vector.h:99
tbb::internal::concurrent_vector_base_v3::segment_allocated
Definition: concurrent_vector.h:100
tbb::internal::concurrent_vector_base_v3::segment_allocation_failed
Definition: concurrent_vector.h:101
tbb::internal::concurrent_vector_base_v3::segment_value_t
Definition: concurrent_vector.h:104
tbb::internal::concurrent_vector_base_v3::segment_value_t::operator==
friend bool operator==(segment_value_t const &lhs, segment_not_used)
Definition: concurrent_vector.h:111
tbb::internal::concurrent_vector_base_v3::segment_value_t::operator==
friend bool operator==(segment_value_t const &lhs, segment_allocated)
Definition: concurrent_vector.h:112
tbb::internal::concurrent_vector_base_v3::segment_value_t::segment_value_t
segment_value_t(void *an_array)
Definition: concurrent_vector.h:109
tbb::internal::concurrent_vector_base_v3::segment_value_t::operator!=
friend bool operator!=(segment_value_t const &lhs, argument_type arg)
Definition: concurrent_vector.h:115
tbb::internal::concurrent_vector_base_v3::segment_value_t::pointer
T * pointer() const
Definition: concurrent_vector.h:118
tbb::internal::concurrent_vector_base_v3::segment_value_t::array
void * array
Definition: concurrent_vector.h:105
tbb::internal::concurrent_vector_base_v3::segment_value_t::operator==
friend bool operator==(segment_value_t const &lhs, segment_allocation_failed)
Definition: concurrent_vector.h:113
tbb::internal::concurrent_vector_base_v3::segment_t
Definition: concurrent_vector.h:128
tbb::internal::concurrent_vector_base_v3::segment_t::array
atomic< void * > array
Definition: concurrent_vector.h:129
tbb::internal::concurrent_vector_base_v3::segment_t::load
segment_value_t load() const
Definition: concurrent_vector.h:147
tbb::internal::concurrent_vector_base_v3::segment_t::store
void store(segment_allocation_failed)
Definition: concurrent_vector.h:155
tbb::internal::concurrent_vector_base_v3::segment_t::store
void store(void *allocated_segment_pointer) __TBB_NOEXCEPT(true)
Definition: concurrent_vector.h:161
tbb::internal::concurrent_vector_base_v3::segment_t::segment_t
segment_t()
Definition: concurrent_vector.h:131
tbb::internal::concurrent_vector_base_v3::segment_t::swap
void swap(segment_t &rhs)
Definition: concurrent_vector.h:137
tbb::internal::concurrent_vector_base_v3::segment_t::store
void store(segment_not_used)
Definition: concurrent_vector.h:150
tbb::internal::concurrent_vector_base_v3::segment_t::operator=
segment_t & operator=(segment_t const &rhs)
Definition: concurrent_vector.h:141
tbb::internal::concurrent_vector_base_v3::segment_t::segment_t
segment_t(segment_t const &rhs)
Definition: concurrent_vector.h:135
tbb::internal::concurrent_vector_base_v3::internal_segments_table
Internal structure for compact()
Definition: concurrent_vector.h:249
tbb::internal::concurrent_vector_base_v3::internal_segments_table::table
segment_t table[pointers_per_long_table]
Definition: concurrent_vector.h:251
tbb::internal::concurrent_vector_base_v3::internal_segments_table::first_block
segment_index_t first_block
Definition: concurrent_vector.h:250
tbb::internal::allocator_base
Definition: concurrent_vector.h:477
tbb::internal::allocator_base::my_allocator
allocator_type my_allocator
Definition: concurrent_vector.h:480
tbb::internal::allocator_base::allocator_base
allocator_base(const allocator_type &a=allocator_type())
Definition: concurrent_vector.h:481
tbb::internal::allocator_base::allocator_type
tbb::internal::allocator_rebind< A, T >::type allocator_type
Definition: concurrent_vector.h:479
tbb::concurrent_vector::generic_range_type
Definition: concurrent_vector.h:554
tbb::concurrent_vector::generic_range_type::difference_type
ptrdiff_t difference_type
Definition: concurrent_vector.h:560
tbb::concurrent_vector::generic_range_type::value_type
T value_type
Definition: concurrent_vector.h:556
tbb::concurrent_vector::generic_range_type::const_reference
const T & const_reference
Definition: concurrent_vector.h:558
tbb::concurrent_vector::generic_range_type::iterator
I iterator
Definition: concurrent_vector.h:559
tbb::concurrent_vector::generic_range_type::reference
T & reference
Definition: concurrent_vector.h:557
tbb::concurrent_vector::generic_range_type::generic_range_type
generic_range_type(const generic_range_type< U > &r)
Definition: concurrent_vector.h:563
tbb::concurrent_vector::generic_range_type::generic_range_type
generic_range_type(I begin_, I end_, size_t grainsize_=1)
Definition: concurrent_vector.h:561
tbb::concurrent_vector::generic_range_type::generic_range_type
generic_range_type(generic_range_type &r, split)
Definition: concurrent_vector.h:564
tbb::concurrent_vector::is_integer_tag
True/false function override helper.
Definition: concurrent_vector.h:1056
tbb::concurrent_vector::internal_loop_guide
Exception-aware helper class for filling a segment by exception-danger operators of user class.
Definition: concurrent_vector.h:1106
tbb::concurrent_vector::internal_loop_guide::internal_loop_guide
internal_loop_guide(size_type ntrials, void *ptr)
Definition: concurrent_vector.h:1115
tbb::concurrent_vector::internal_loop_guide::move_construct
void move_construct(const void *src)
Definition: concurrent_vector.h:1123
tbb::concurrent_vector::internal_loop_guide::iterate
void iterate(I &src)
Definition: concurrent_vector.h:1130
tbb::concurrent_vector::internal_loop_guide::as_pointer
static T * as_pointer(const void *src)
Definition: concurrent_vector.h:1113
tbb::concurrent_vector::internal_loop_guide::i
size_type i
Definition: concurrent_vector.h:1110
tbb::concurrent_vector::internal_loop_guide::init
void init(const void *src)
Definition: concurrent_vector.h:1118
tbb::concurrent_vector::internal_loop_guide::assign
void assign(const void *src)
Definition: concurrent_vector.h:1120
tbb::concurrent_vector::internal_loop_guide::n
const size_type n
Definition: concurrent_vector.h:1109
tbb::concurrent_vector::internal_loop_guide::copy
void copy(const void *src)
Definition: concurrent_vector.h:1119
tbb::concurrent_vector::internal_loop_guide::~internal_loop_guide
~internal_loop_guide()
Definition: concurrent_vector.h:1131
tbb::concurrent_vector::internal_loop_guide::move_assign
void move_assign(const void *src)
Definition: concurrent_vector.h:1122
tbb::concurrent_vector::internal_loop_guide::array
const pointer array
Definition: concurrent_vector.h:1108
tbb::concurrent_vector::internal_loop_guide::as_const_pointer
static const T * as_const_pointer(const void *ptr)
Definition: concurrent_vector.h:1112
tbb::concurrent_vector::internal_loop_guide::init
void init()
Definition: concurrent_vector.h:1117
tbb::concurrent_vector::push_back_helper
Definition: concurrent_vector.h:1138
tbb::concurrent_vector::push_back_helper::v
concurrent_vector & v
Definition: concurrent_vector.h:1151
tbb::concurrent_vector::push_back_helper::g
element_construction_guard g
Definition: concurrent_vector.h:1153
tbb::concurrent_vector::push_back_helper::k
size_type k
Definition: concurrent_vector.h:1152
tbb::concurrent_vector::push_back_helper::return_iterator_and_dismiss
iterator return_iterator_and_dismiss()
Definition: concurrent_vector.h:1161
tbb::concurrent_vector::push_back_helper::push_back_helper
push_back_helper(concurrent_vector &vector)
Definition: concurrent_vector.h:1155
tbb::concurrent_vector::push_back_helper::internal_push_back_result
pointer internal_push_back_result()
Definition: concurrent_vector.h:1160
tbb::concurrent_vector::push_back_helper::element_construction_guard
Definition: concurrent_vector.h:1139
tbb::concurrent_vector::push_back_helper::element_construction_guard::~element_construction_guard
~element_construction_guard()
Definition: concurrent_vector.h:1144
tbb::concurrent_vector::push_back_helper::element_construction_guard::element_construction_guard
element_construction_guard(pointer an_element)
Definition: concurrent_vector.h:1142
tbb::concurrent_vector::push_back_helper::element_construction_guard::element
pointer element
Definition: concurrent_vector.h:1140
tbb::concurrent_vector::push_back_helper::element_construction_guard::dismiss
void dismiss()
Definition: concurrent_vector.h:1143
tbb::internal::allocator_rebind::type
allocator_traits< Alloc >::template rebind_alloc< T >::other type
Definition: _allocator_traits.h:149
tbb::internal::no_copy
Base class for types that should not be copied or assigned.
Definition: tbb_stddef.h:330
tbb::split
Dummy type that distinguishes splitting constructor from copy constructor.
Definition: tbb_stddef.h:416
tbb::internal::bool_constant
Definition: tbb_stddef.h:486
tbb::internal::concurrent_vector_base_v3::helper
Definition: concurrent_vector.cpp:40

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.