17 #ifndef __TBB_concurrent_vector_H 18 #define __TBB_concurrent_vector_H 29 #include __TBB_STD_SWAP_HEADER 35 #if _MSC_VER==1500 && !__INTEL_COMPILER 37 #pragma warning( push ) 38 #pragma warning( disable: 4985 ) 41 #if _MSC_VER==1500 && !__INTEL_COMPILER 42 #pragma warning( pop ) 45 #if __TBB_INITIALIZER_LISTS_PRESENT 46 #include <initializer_list> 49 #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) 51 #pragma warning (push) 53 #pragma warning (disable: 4267) 55 #pragma warning (disable: 4127) //warning C4127: conditional expression is constant 60 template<
typename T,
class A = cache_aligned_allocator<T> >
66 template<
typename Container,
typename Value>
75 std::memset( static_cast<void*>(array), 0, n_of_elements *
sizeof( T ) );
111 template<
typename argument_type>
115 T*
pointer()
const {
return static_cast<T*>(const_cast<void*>(
array)); }
135 tbb::internal::swap<relaxed>(
array, rhs.
array);
143 template<memory_semantics M>
146 template<memory_semantics M>
151 template<memory_semantics M>
157 template<memory_semantics M>
160 "other overloads of store should be used for marking segment as not_used or allocation_failed" );
234 __TBB_ASSERT(element_index,
"there should be no need to call " 235 "is_first_element_in_segment for 0th element" );
276 template<
typename Container,
typename Value>
290 template<
typename Container,
typename Value>
303 template<
typename C,
typename T>
306 template<
typename C,
typename T,
typename U>
309 template<
typename C,
typename T,
typename U>
312 template<
typename C,
typename T,
typename U>
315 template<
typename C,
typename U>
318 #if !__TBB_TEMPLATE_FRIENDS_BROKEN 319 template<
typename T,
class A>
326 my_vector(const_cast<Container*>(&vector)),
328 my_item(static_cast<Value*>(ptr))
388 __TBB_ASSERT(
my_index>0,
"operator--() applied to iterator already at beginning of concurrent_vector" );
425 template<
typename Container,
typename T>
430 template<
typename Container,
typename T,
typename U>
435 template<
typename Container,
typename T,
typename U>
440 template<
typename Container,
typename T,
typename U>
445 template<
typename Container,
typename T,
typename U>
450 template<
typename Container,
typename T,
typename U>
455 template<
typename Container,
typename T,
typename U>
460 template<
typename Container,
typename T,
typename U>
465 template<
typename T,
class A>
538 template<
typename T,
class A>
539 class concurrent_vector:
protected internal::allocator_base<T, A>,
556 template<
typename C,
typename U>
557 friend class internal::vector_iterator;
573 typedef internal::vector_iterator<concurrent_vector,T>
iterator;
576 #if !defined(_MSC_VER) || _CPPLIB_VER>=300 605 #if __TBB_INITIALIZER_LISTS_PRESENT 620 #endif //# __TBB_INITIALIZER_LISTS_PRESENT 636 #if __TBB_CPP11_RVALUE_REF_PRESENT 652 if (a == source.my_allocator) {
726 if(
this != &vector )
731 #if __TBB_CPP11_RVALUE_REF_PRESENT 735 __TBB_ASSERT(
this != &other,
"Move assignment to itself is prohibited ");
752 if( static_cast<void*>(
this ) != static_cast<const void*>( &vector ) )
758 #if __TBB_INITIALIZER_LISTS_PRESENT 765 #endif //#if __TBB_INITIALIZER_LISTS_PRESENT 785 typename std::iterator_traits<I>::difference_type delta = std::distance(
first,
last);
791 #if __TBB_INITIALIZER_LISTS_PRESENT 794 return grow_by( init_list.begin(), init_list.end() );
796 #endif //#if __TBB_INITIALIZER_LISTS_PRESENT 827 push_back_helper prolog(*
this);
828 new(prolog.internal_push_back_result()) T(item);
829 return prolog.return_iterator_and_dismiss();
832 #if __TBB_CPP11_RVALUE_REF_PRESENT 837 push_back_helper prolog(*
this);
838 new(prolog.internal_push_back_result()) T(
std::move(item));
839 return prolog.return_iterator_and_dismiss();
841 #if __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT 844 template<
typename... Args>
847 push_back_helper prolog(*
this);
848 new(prolog.internal_push_back_result()) T(std::forward<Args>(args)...);
849 return prolog.return_iterator_and_dismiss();
851 #endif //__TBB_CPP11_VARIADIC_TEMPLATES_PRESENT 852 #endif //__TBB_CPP11_RVALUE_REF_PRESENT 891 return cp < sz ? cp : sz;
956 return (segment_value.template
pointer<T>())[0];
989 #if __TBB_INITIALIZER_LISTS_PRESENT 990 void assign(std::initializer_list<T> init_list) {
994 #endif //# __TBB_INITIALIZER_LISTS_PRESENT 1072 #if __TBB_MOVE_IF_NOEXCEPT_PRESENT 1075 #endif //__TBB_MOVE_IF_NO_EXCEPT_PRESENT 1077 #if __TBB_CPP11_RVALUE_REF_PRESENT 1084 template<
typename Iterator>
1102 static T*
as_pointer(
const void *src) {
return static_cast<T*>(const_cast<void *>(src)); }
1110 #if __TBB_CPP11_RVALUE_REF_PRESENT 1114 #if __TBB_MOVE_IF_NOEXCEPT_PRESENT 1115 void move_construct_if_noexcept(
const void *src) {
for(;
i <
n; ++
i)
new( &
array[
i] ) T( std::move_if_noexcept(
as_pointer(src)[
i]) ); }
1116 #endif //__TBB_MOVE_IF_NOEXCEPT_PRESENT 1119 template<
class I>
void iterate(I &src) {
for(;
i <
n; ++
i, ++src)
new( &
array[
i] ) T( *src ); }
1158 #if __TBB_CPP17_DEDUCTION_GUIDES_PRESENT 1160 template<
typename I,
1161 typename T =
typename std::iterator_traits<I>::value_type,
1162 typename A = cache_aligned_allocator<T>
1163 > concurrent_vector(I, I,
const A& = A())
1164 -> concurrent_vector<T, A>;
1167 template<
typename T,
typename A1,
typename A2>
1168 concurrent_vector(
const concurrent_vector<T, A1> &,
const A2 &)
1169 -> concurrent_vector<T, A2>;
1172 template<
typename T,
typename A = cache_aligned_allocator<T>
1173 > concurrent_vector(std::initializer_list<T>,
const A& = A())
1174 -> concurrent_vector<T, A>;
1177 #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) 1178 #pragma warning (push) 1179 #pragma warning (disable: 4701) // potentially uninitialized local variable "old" 1181 template<
typename T,
class A>
1185 internal_array_op2 copy_or_move_array =
1186 #if __TBB_MOVE_IF_NOEXCEPT_PRESENT 1187 &move_array_if_noexcept
1192 if( internal_compact(
sizeof(T), &old, &destroy_array, copy_or_move_array ) )
1193 internal_free_segments( old.
table, pointers_per_long_table, old.
first_block );
1200 #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) 1201 #pragma warning (pop) 1202 #endif // warning 4701 is back 1204 template<
typename T,
class A>
1207 while( k > first_block ) {
1212 this->my_allocator.deallocate( (segment_value.
pointer<T>()), segment_size(k) );
1218 this->my_allocator.deallocate( (segment_value.
pointer<T>()), segment_size(first_block) );
1222 template<
typename T,
class A>
1225 __TBB_ASSERT( index < my_early_size,
"index out of bounds" );
1228 __TBB_ASSERT( my_segment.load<
acquire>() != my_storage || k < pointers_per_short_table,
"index is being allocated" );
1233 segment_value_t segment_value = my_segment[k].template load<relaxed>();
1236 return (( segment_value.
pointer<T>()))[j];
1239 template<
typename T,
class A>
1241 if( index >= my_early_size )
1246 if( my_segment.load<
acquire>() == my_storage && k >= pointers_per_short_table )
1252 segment_value_t segment_value = my_segment[k].template load<relaxed>();
1254 return (segment_value.
pointer<T>())[j];
1257 template<
typename T,
class A>
template<
class I>
1262 internal_reserve(n,
sizeof(T), max_size());
1266 size_type sz = segment_size( my_first_block );
1268 internal_loop_guide loop(sz, my_segment[k].
template load<relaxed>().
template pointer<void>());
1269 loop.iterate(
first);
1271 if( !k ) k = my_first_block;
1272 else { ++k; sz <<= 1; }
1274 internal_loop_guide loop(n, my_segment[k].
template load<relaxed>().
template pointer<void>());
1275 loop.iterate(
first);
1278 template<
typename T,
class A>
1280 internal_loop_guide loop(n,
begin); loop.init();
1283 template<
typename T,
class A>
1285 internal_loop_guide loop(n,
begin); loop.init(src);
1288 template<
typename T,
class A>
1290 internal_loop_guide loop(n, dst); loop.copy(src);
1293 #if __TBB_CPP11_RVALUE_REF_PRESENT 1294 template<
typename T,
class A>
1296 internal_loop_guide loop(n, dst); loop.move_construct(src);
1298 template<
typename T,
class A>
1300 internal_loop_guide loop(n, dst); loop.move_assign(src);
1304 #if __TBB_MOVE_IF_NOEXCEPT_PRESENT 1305 template<
typename T,
class A>
1307 internal_loop_guide loop(n, dst); loop.move_construct_if_noexcept(src);
1309 #endif //__TBB_MOVE_IF_NOEXCEPT_PRESENT 1311 template<
typename T,
class A>
1312 template<
typename I>
1314 internal_loop_guide loop(n, dst);
1315 loop.iterate( *(static_cast<I*>(const_cast<void*>(p_type_erased_iterator))) );
1318 template<
typename T,
class A>
1320 internal_loop_guide loop(n, dst); loop.assign(src);
1323 #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) 1325 #pragma warning (push) 1326 #pragma warning (disable: 4189) 1328 template<
typename T,
class A>
1330 T* array = static_cast<T*>(
begin);
1334 #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) 1335 #pragma warning (pop) 1336 #endif // warning 4189 is back 1339 template<
typename T,
class A1,
class A2>
1343 if(a.size() != b.size())
return false;
1346 for(; i != a.end(); ++i, ++j)
1347 if( !(*i == *j) )
return false;
1351 template<
typename T,
class A1,
class A2>
1353 {
return !(a == b); }
1355 template<
typename T,
class A1,
class A2>
1357 {
return (std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end())); }
1359 template<
typename T,
class A1,
class A2>
1363 template<
typename T,
class A1,
class A2>
1365 {
return !(b < a); }
1367 template<
typename T,
class A1,
class A2>
1369 {
return !(a < b); }
1371 template<
typename T,
class A>
1377 #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) 1378 #pragma warning (pop) 1379 #endif // warning 4267,4127 are back 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,...
friend bool operator==(segment_value_t const &lhs, segment_not_used)
const_reverse_iterator rend() const
reverse end const iterator
concurrent_vector & operator=(concurrent_vector &&other)
Move assignment.
bool operator>(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
void(__TBB_EXPORTED_FUNC * internal_array_op1)(void *begin, size_type n)
An operation on an n-element array starting at begin.
element_construction_guard g
const_reverse_iterator rbegin() const
reverse start const iterator
static void __TBB_EXPORTED_FUNC initialize_array(void *begin, const void *, size_type n)
Construct n instances of T, starting at "begin".
iterator grow_to_at_least(size_type n, const_reference t)
concurrent_vector_base_v3 concurrent_vector_base
allocator_base(const allocator_type &a=allocator_type())
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)
vector_iterator operator++(int)
Post increment.
generic_range_type< const_iterator > const_range_type
friend bool operator<(const vector_iterator< C, T > &i, const vector_iterator< C, U > &j)
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.
Class for determining type of std::allocator<T>::value_type.
static const T * as_const_pointer(const void *ptr)
friend void swap(segment_t &, segment_t &) __TBB_NOEXCEPT(true)
const_iterator end() const
end const iterator
bool operator!=(const cache_aligned_allocator< T > &, const cache_aligned_allocator< U > &)
Value & operator*() const
iterator begin()
start iterator
reverse_iterator rend()
reverse end iterator
iterator grow_by(size_type delta, const_reference t)
Grow by "delta" elements using copying constructor.
auto last(Container &c) -> decltype(begin(c))
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)
const_iterator end() const
One past last value in range.
tbb::internal::allocator_rebind< A, T >::type allocator_type
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...
vector_iterator< Container, T > operator+(ptrdiff_t offset, const vector_iterator< Container, T > &v)
bool operator>=(const concurrent_vector< T, A1 > &a, const concurrent_vector< T, A2 > &b)
friend vector_iterator< C, T > operator+(ptrdiff_t offset, const vector_iterator< C, T > &v)
void assign(const void *src)
bool empty() const
Return false if vector is not empty or has elements under construction at least.
Base class of concurrent vector implementation.
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".
#define __TBB_EXPORTED_METHOD
static segment_index_t segment_base(segment_index_t k)
vector_iterator operator-(ptrdiff_t offset) const
reference front()
the first item
void resize(size_type n)
Resize the vector. Not thread-safe.
void store(void *allocated_segment_pointer) __TBB_NOEXCEPT(true)
reference back()
the last item
static void *const vector_allocation_error_flag
Bad allocation marker.
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
T & internal_subscript_with_exceptions(size_type index) const
Get reference to element at given index with errors checks.
void const char const char int ITT_FORMAT __itt_group_sync s
const_reference back() const
the last item const
const_range_type range(size_t grainsize=1) const
Get const range for iterating with parallel algorithms.
bool operator==(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
void __TBB_EXPORTED_METHOD internal_throw_exception(size_type) const
Obsolete.
iterator return_iterator_and_dismiss()
static segment_index_t segment_base_index_of(segment_index_t &index)
iterator end()
end iterator
const_iterator begin() const
Beginning of range.
Value * operator->() const
#define __TBB_EXPORTED_FUNC
std::random_access_iterator_tag iterator_category
~element_construction_guard()
static void * internal_allocator(internal::concurrent_vector_base_v3 &vb, size_t k)
Allocate k items.
auto first(Container &c) -> decltype(begin(c))
size_type size() const
Return size of vector. It may include elements under construction.
void store(segment_not_used)
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.
vector_iterator(const Container &vector, size_t index, void *ptr=0)
void store(segment_allocation_failed)
void allocator_swap(MyAlloc &my_allocator, OtherAlloc &other_allocator, traits_true_type)
void internal_free_segments(segment_t table[], segment_index_t k, segment_index_t first_block)
Free k segments from table.
generic_range_type< iterator > range_type
vector_iterator & operator++()
Pre increment.
iterator grow_by(size_type delta)
Grow by "delta" elements.
const internal::concurrent_vector_base_v3 & internal_vector_base() const
Exception-aware helper class for filling a segment by exception-danger operators of user class.
void *(* vector_allocator_ptr)(concurrent_vector_base_v3 &, size_t)
allocator function pointer
T & internal_subscript(size_type index) const
Get reference to element at given index.
atomic< segment_t * > my_segment
Pointer to the segments table.
concurrent_vector(const concurrent_vector &vector, const allocator_type &a=allocator_type())
Copying constructor.
void internal_grow(size_type start, size_type finish, size_type element_size, internal_array_op2 init, const void *src)
internal::concurrent_vector_base_v3::size_type size_type
pointer internal_push_back_result()
std::reverse_iterator< iterator > reverse_iterator
bool operator==(const cache_aligned_allocator< T > &, const cache_aligned_allocator< U > &)
Value * my_item
Caches my_vector->internal_subscript(my_index)
const_iterator cend() const
end const iterator
std::reverse_iterator< const_iterator > const_reverse_iterator
iterator push_back(T &&item)
Push item, move-aware.
allocator_type my_allocator
void clear()
Clear container while keeping memory allocated.
size_t my_index
Index into the vector.
iterator grow_by(std::initializer_list< T > init_list)
concurrent_vector(const allocator_type &a=allocator_type())
Construct empty vector.
Meets requirements of a forward iterator for STL and a Value for a blocked_range.*/.
concurrent_vector(size_type n)
Construction with initial size specified by argument n.
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
vector_iterator()
Default constructor.
void swap(concurrent_vector &vector)
swap two instances
size_type capacity() const
Maximum size to which array can grow without allocating more memory. Concurrent allocations are not i...
#define __TBB_NOEXCEPT(expression)
void copy(const void *src)
static T * as_pointer(const void *src)
void __TBB_EXPORTED_METHOD internal_reserve(size_type n, size_type element_size, size_type max_size)
size_type max_size() const
Upper bound on argument to reserve.
const_reverse_iterator crbegin() const
reverse start const iterator
concurrent_vector_base_v3()
void swap(segment_t &rhs)
const_iterator cbegin() const
start const iterator
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_swap(concurrent_vector_base_v3 &v)
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
concurrent_vector(const concurrent_vector< T, M > &vector, const allocator_type &a=allocator_type())
Copying constructor for vector with different allocator type.
concurrent_vector & operator=(const concurrent_vector< T, M > &vector)
Assignment for vector with different allocator type.
element_construction_guard(pointer an_element)
Specialization for atomic<void*>, for sake of not allowing arithmetic or operator->.
internal::vector_iterator< concurrent_vector, const T > const_iterator
void reserve(size_type n)
Allocate enough space to grow to size n without having to allocate more memory later.
~concurrent_vector()
Clear and destroy vector.
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....
void shrink_to_fit()
Optimize memory usage and fragmentation.
internal::allocator_base< T, A >::allocator_type allocator_type
iterator grow_by(I first, I last)
void move(tbb_thread &t1, tbb_thread &t2)
iterator grow_to_at_least(size_type n)
Append minimal sequence of elements such that size()>=n.
bool operator<(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
void internal_assign_n(size_type n, const_pointer p)
assign n items by copying t
Concurrent vector container.
reverse_iterator rbegin()
reverse start iterator
void __TBB_EXPORTED_METHOD internal_copy(const concurrent_vector_base_v3 &src, size_type element_size, internal_array_op2 copy)
segment_t my_storage[pointers_per_short_table]
embedded storage of segment pointers
void resize(size_type n, const_reference t)
Resize the vector, copy t for new elements. Not thread-safe.
void internal_assign_range(I first, I last, is_integer_tag< false > *)
inline proxy assign by iterators
size_type __TBB_EXPORTED_METHOD internal_grow_by(size_type delta, size_type element_size, internal_array_op2 init, const void *src)
segment_index_t __TBB_EXPORTED_METHOD internal_clear(internal_array_op1 destroy)
vector_iterator(const vector_iterator< Container, typename Container::value_type > &other)
Value & operator[](ptrdiff_t k) const
concurrent_vector(concurrent_vector &&source)
Move constructor.
allocator_traits< Alloc >::template rebind_alloc< T >::other type
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 store(value_type value)
True/false function override helper.
const_reference front() const
the first item const
push_back_helper(concurrent_vector &vector)
segment_value_t(void *an_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".
vector_iterator operator--(int)
Post decrement.
static size_type segment_size(segment_index_t k)
bool operator<=(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
bool operator<=(const concurrent_vector< T, A1 > &a, const concurrent_vector< T, A2 > &b)
Internal structure for compact()
void move_construct(const void *src)
A range over which to iterate.
reference at(size_type index)
Get reference to element at given index. Throws exceptions on errors.
static bool is_first_element_in_segment(size_type element_index)
segment_index_t first_block
friend class internal::vector_iterator
ptrdiff_t difference_type
bool operator<(const concurrent_vector< T, A1 > &a, const concurrent_vector< T, A2 > &b)
ptrdiff_t operator-(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
bool operator!=(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
iterator emplace_back(Args &&... args)
Push item, create item "in place" with provided arguments.
bool operator>=(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
void *__TBB_EXPORTED_METHOD internal_push_back(size_type element_size, size_type &index)
generic_range_type(const generic_range_type< U > &r)
size_type __TBB_EXPORTED_METHOD internal_capacity() const
intptr_t __TBB_Log2(uintptr_t x)
allocator_type get_allocator() const
return allocator object
vector_iterator & operator+=(ptrdiff_t offset)
bool operator>(const concurrent_vector< T, A1 > &a, const concurrent_vector< T, A2 > &b)
atomic< size_type > my_first_block
count of segments in the first block
segment_t & operator=(segment_t const &rhs)
vector_iterator & operator--()
Pre decrement.
segment_t table[pointers_per_long_table]
vector_iterator & operator-=(ptrdiff_t offset)
const T & const_reference
iterator push_back(const_reference item)
Push item.
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.
void allocator_move_assignment(MyAlloc &my_allocator, OtherAlloc &other_allocator, traits_true_type)
internal_loop_guide(size_type ntrials, void *ptr)
generic_range_type(I begin_, I end_, size_t grainsize_=1)
reference operator[](size_type index)
Get reference to element at given index.
const_reference at(size_type index) const
Get const reference to element at given index. Throws exceptions on errors.
const_reverse_iterator crend() const
reverse end const iterator
friend bool operator==(segment_value_t const &lhs, segment_allocation_failed)
static void __TBB_EXPORTED_FUNC destroy_array(void *begin, size_type n)
Destroy n instances of T, starting at "begin".
ptrdiff_t difference_type
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
friend bool operator==(const vector_iterator< C, T > &i, const vector_iterator< C, U > &j)
Container * my_vector
concurrent_vector over which we are iterating.
void const char const char int ITT_FORMAT __itt_group_sync p
Number of slots for segment pointers inside the class.
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.
const_reference operator[](size_type index) const
Get const reference to element at given index.
void assign(size_type n, const_reference t)
assign n items by copying t item
vector_iterator operator+(ptrdiff_t offset) const
concurrent_vector & operator=(const concurrent_vector &vector)
Assignment.
static segment_index_t segment_index_of(size_type index)
void swap(concurrent_hash_map< Key, T, HashCompare, A > &a, concurrent_hash_map< Key, T, HashCompare, A > &b)
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,...
friend ptrdiff_t operator-(const vector_iterator< C, T > &i, const vector_iterator< C, U > &j)
void throw_exception(exception_id eid)
Versionless convenience wrapper for throw_exception_v4()
void move_assign(const void *src)
range_type range(size_t grainsize=1)
Get range for iterating with parallel algorithms.
void internal_assign_iterators(I first, I last)
assign by iterators
concurrent_vector(concurrent_vector &&source, const allocator_type &a)
const_iterator begin() const
start const iterator
ptrdiff_t difference_type
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...
segment_t(segment_t const &rhs)
atomic< size_type > my_early_size
Requested size of vector.
friend bool operator!=(segment_value_t const &lhs, argument_type arg)
void init(const void *src)
void assign(I first, I last)
assign range [first, last)
generic_range_type(generic_range_type &r, split)
concurrent_vector(I first, I last, const allocator_type &a=allocator_type())
Construction with copying iteration range and given allocator instance.
friend bool operator==(segment_value_t const &lhs, segment_allocated)
Dummy type that distinguishes splitting constructor from copy constructor.
__TBB_EXPORTED_METHOD ~concurrent_vector_base_v3()
const T & const_reference
internal::vector_iterator< concurrent_vector, T > iterator
segment_value_t load() const
friend void enforce_segment_allocated(segment_value_t const &s, internal::exception_id exception=eid_bad_last_alloc)
void handle_unconstructed_elements(T *array, size_t n_of_elements)
Exception helper function.
void swap(atomic< T > &lhs, atomic< T > &rhs)
size_type grainsize() const
The grain size for this range.