Intel(R) Threading Building Blocks Doxygen Documentation
version 4.2.3
|
Go to the documentation of this file.
17 #ifndef __TBB_concurrent_vector_H
18 #define __TBB_concurrent_vector_H
20 #define __TBB_concurrent_vector_H_include_area
32 #include __TBB_STD_SWAP_HEADER
38 #if _MSC_VER==1500 && !__INTEL_COMPILER
40 #pragma warning( push )
41 #pragma warning( disable: 4985 )
44 #if _MSC_VER==1500 && !__INTEL_COMPILER
45 #pragma warning( pop )
48 #if __TBB_INITIALIZER_LISTS_PRESENT
49 #include <initializer_list>
52 #if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
54 #pragma warning (push)
56 #pragma warning (disable: 4267)
58 #pragma warning (disable: 4127) //warning C4127: conditional expression is constant
63 template<
typename T,
class A = cache_aligned_allocator<T> >
69 template<
typename Container,
typename Value>
78 std::memset( static_cast<void*>(array), 0, n_of_elements *
sizeof( T ) );
114 template<
typename argument_type>
118 T*
pointer()
const {
return static_cast<T*>(const_cast<void*>(
array)); }
138 tbb::internal::swap<relaxed>(
array, rhs.
array);
146 template<memory_semantics M>
149 template<memory_semantics M>
154 template<memory_semantics M>
160 template<memory_semantics M>
163 "other overloads of store should be used for marking segment as not_used or allocation_failed" );
164 array.store<M>(allocated_segment_pointer);
237 __TBB_ASSERT(element_index,
"there should be no need to call "
238 "is_first_element_in_segment for 0th element" );
279 template<
typename Container,
typename Value>
293 template<
typename Container,
typename Value>
306 template<
typename C,
typename T>
309 template<
typename C,
typename T,
typename U>
312 template<
typename C,
typename T,
typename U>
315 template<
typename C,
typename T,
typename U>
318 template<
typename C,
typename U>
321 #if !__TBB_TEMPLATE_FRIENDS_BROKEN
322 template<
typename T,
class A>
329 my_vector(const_cast<Container*>(&vector)),
331 my_item(static_cast<Value*>(ptr))
399 __TBB_ASSERT(
my_index>0,
"operator--() applied to iterator already at beginning of concurrent_vector" );
436 template<
typename Container,
typename T>
441 template<
typename Container,
typename T,
typename U>
446 template<
typename Container,
typename T,
typename U>
451 template<
typename Container,
typename T,
typename U>
456 template<
typename Container,
typename T,
typename U>
461 template<
typename Container,
typename T,
typename U>
466 template<
typename Container,
typename T,
typename U>
471 template<
typename Container,
typename T,
typename U>
476 template<
typename T,
class A>
549 template<
typename T,
class A>
550 class concurrent_vector:
protected internal::allocator_base<T, A>,
567 template<
typename C,
typename U>
587 #if !defined(_MSC_VER) || _CPPLIB_VER>=300
616 #if __TBB_INITIALIZER_LISTS_PRESENT
631 #endif //# __TBB_INITIALIZER_LISTS_PRESENT
647 #if __TBB_CPP11_RVALUE_REF_PRESENT
663 if (a == source.my_allocator) {
737 if(
this != &vector )
742 #if __TBB_CPP11_RVALUE_REF_PRESENT
746 __TBB_ASSERT(
this != &other,
"Move assignment to itself is prohibited ");
763 if( static_cast<void*>(
this ) != static_cast<const void*>( &vector ) )
769 #if __TBB_INITIALIZER_LISTS_PRESENT
776 #endif //#if __TBB_INITIALIZER_LISTS_PRESENT
796 typename std::iterator_traits<I>::difference_type delta = std::distance(
first,
last);
802 #if __TBB_INITIALIZER_LISTS_PRESENT
805 return grow_by( init_list.begin(), init_list.end() );
807 #endif //#if __TBB_INITIALIZER_LISTS_PRESENT
838 push_back_helper prolog(*
this);
839 new(prolog.internal_push_back_result()) T(item);
840 return prolog.return_iterator_and_dismiss();
843 #if __TBB_CPP11_RVALUE_REF_PRESENT
848 push_back_helper prolog(*
this);
849 new(prolog.internal_push_back_result()) T(
std::move(item));
850 return prolog.return_iterator_and_dismiss();
852 #if __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT
855 template<
typename... Args>
858 push_back_helper prolog(*
this);
859 new(prolog.internal_push_back_result()) T(std::forward<Args>(args)...);
860 return prolog.return_iterator_and_dismiss();
862 #endif //__TBB_CPP11_VARIADIC_TEMPLATES_PRESENT
863 #endif //__TBB_CPP11_RVALUE_REF_PRESENT
902 return cp < sz ? cp : sz;
967 return (segment_value.template
pointer<T>())[0];
1000 #if __TBB_INITIALIZER_LISTS_PRESENT
1001 void assign(std::initializer_list<T> init_list) {
1005 #endif //# __TBB_INITIALIZER_LISTS_PRESENT
1083 #if __TBB_MOVE_IF_NOEXCEPT_PRESENT
1086 #endif //__TBB_MOVE_IF_NO_EXCEPT_PRESENT
1088 #if __TBB_CPP11_RVALUE_REF_PRESENT
1095 template<
typename Iterator>
1113 static T*
as_pointer(
const void *src) {
return static_cast<T*>(const_cast<void *>(src)); }
1121 #if __TBB_CPP11_RVALUE_REF_PRESENT
1125 #if __TBB_MOVE_IF_NOEXCEPT_PRESENT
1126 void move_construct_if_noexcept(
const void *src) {
for(;
i <
n; ++
i)
new( &
array[
i] ) T( std::move_if_noexcept(
as_pointer(src)[
i]) ); }
1127 #endif //__TBB_MOVE_IF_NOEXCEPT_PRESENT
1130 template<
class I>
void iterate(I &src) {
for(;
i <
n; ++
i, ++src)
new( &
array[
i] ) T( *src ); }
1169 #if __TBB_CPP17_DEDUCTION_GUIDES_PRESENT
1171 template<
typename I,
1172 typename T =
typename std::iterator_traits<I>::value_type,
1173 typename A = cache_aligned_allocator<T>
1174 > concurrent_vector(I, I,
const A& = A())
1175 -> concurrent_vector<T, A>;
1178 template<
typename T,
typename A1,
typename A2>
1179 concurrent_vector(
const concurrent_vector<T, A1> &,
const A2 &)
1180 -> concurrent_vector<T, A2>;
1183 template<
typename T,
typename A = cache_aligned_allocator<T>
1184 > concurrent_vector(std::initializer_list<T>,
const A& = A())
1185 -> concurrent_vector<T, A>;
1188 #if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
1189 #pragma warning (push)
1190 #pragma warning (disable: 4701) // potentially uninitialized local variable "old"
1192 template<
typename T,
class A>
1196 internal_array_op2 copy_or_move_array =
1197 #if __TBB_MOVE_IF_NOEXCEPT_PRESENT
1198 &move_array_if_noexcept
1203 if( internal_compact(
sizeof(T), &old, &destroy_array, copy_or_move_array ) )
1204 internal_free_segments( old.
table, pointers_per_long_table, old.
first_block );
1211 #if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
1212 #pragma warning (pop)
1213 #endif // warning 4701 is back
1215 template<
typename T,
class A>
1218 while( k > first_block ) {
1223 this->my_allocator.deallocate( (segment_value.
pointer<T>()), segment_size(k) );
1229 this->my_allocator.deallocate( (segment_value.
pointer<T>()), segment_size(first_block) );
1233 template<
typename T,
class A>
1236 __TBB_ASSERT( index < my_early_size,
"index out of bounds" );
1239 __TBB_ASSERT( my_segment.load<
acquire>() != my_storage || k < pointers_per_short_table,
"index is being allocated" );
1244 segment_value_t segment_value = my_segment[k].template load<relaxed>();
1247 return (( segment_value.
pointer<T>()))[j];
1250 template<
typename T,
class A>
1252 if( index >= my_early_size )
1257 if( my_segment.load<
acquire>() == my_storage && k >= pointers_per_short_table )
1263 segment_value_t segment_value = my_segment[k].template load<relaxed>();
1265 return (segment_value.
pointer<T>())[j];
1268 template<
typename T,
class A>
template<
class I>
1273 internal_reserve(n,
sizeof(T), max_size());
1277 size_type sz = segment_size( my_first_block );
1279 internal_loop_guide loop(sz, my_segment[k].
template load<relaxed>().
template pointer<void>());
1280 loop.iterate(
first);
1282 if( !k ) k = my_first_block;
1283 else { ++k; sz <<= 1; }
1285 internal_loop_guide loop(n, my_segment[k].
template load<relaxed>().
template pointer<void>());
1286 loop.iterate(
first);
1289 template<
typename T,
class A>
1291 internal_loop_guide loop(n,
begin); loop.init();
1294 template<
typename T,
class A>
1296 internal_loop_guide loop(n,
begin); loop.init(src);
1299 template<
typename T,
class A>
1301 internal_loop_guide loop(n, dst); loop.copy(src);
1304 #if __TBB_CPP11_RVALUE_REF_PRESENT
1305 template<
typename T,
class A>
1307 internal_loop_guide loop(n, dst); loop.move_construct(src);
1309 template<
typename T,
class A>
1311 internal_loop_guide loop(n, dst); loop.move_assign(src);
1315 #if __TBB_MOVE_IF_NOEXCEPT_PRESENT
1316 template<
typename T,
class A>
1318 internal_loop_guide loop(n, dst); loop.move_construct_if_noexcept(src);
1320 #endif //__TBB_MOVE_IF_NOEXCEPT_PRESENT
1322 template<
typename T,
class A>
1323 template<
typename I>
1325 internal_loop_guide loop(n, dst);
1326 loop.iterate( *(static_cast<I*>(const_cast<void*>(p_type_erased_iterator))) );
1329 template<
typename T,
class A>
1331 internal_loop_guide loop(n, dst); loop.assign(src);
1334 #if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
1336 #pragma warning (push)
1337 #pragma warning (disable: 4189)
1339 template<
typename T,
class A>
1341 T* array = static_cast<T*>(
begin);
1345 #if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
1346 #pragma warning (pop)
1347 #endif // warning 4189 is back
1350 template<
typename T,
class A1,
class A2>
1354 if(a.size() != b.size())
return false;
1357 for(; i != a.end(); ++i, ++j)
1358 if( !(*i == *j) )
return false;
1362 template<
typename T,
class A1,
class A2>
1364 {
return !(a == b); }
1366 template<
typename T,
class A1,
class A2>
1368 {
return (std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end())); }
1370 template<
typename T,
class A1,
class A2>
1374 template<
typename T,
class A1,
class A2>
1376 {
return !(b < a); }
1378 template<
typename T,
class A1,
class A2>
1380 {
return !(a < b); }
1382 template<
typename T,
class A>
1388 #if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
1389 #pragma warning (pop)
1390 #endif // warning 4267,4127 are back
1393 #undef __TBB_concurrent_vector_H_include_area
const_iterator begin() const
start const iterator
vector_iterator()
Default constructor.
bool operator!=(const cache_aligned_allocator< T > &, const cache_aligned_allocator< U > &)
iterator grow_by(size_type delta, const_reference t)
Grow by "delta" elements using copying constructor.
size_type max_size() const
Upper bound on argument to reserve.
void internal_assign_iterators(I first, I last)
assign by iterators
concurrent_vector(concurrent_vector &&source, const allocator_type &a)
void(__TBB_EXPORTED_FUNC * internal_array_op1)(void *begin, size_type n)
An operation on an n-element array starting at begin.
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...
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.
True/false function override helper.
internal::allocator_base< T, A >::allocator_type allocator_type
void __TBB_EXPORTED_METHOD internal_reserve(size_type n, size_type element_size, size_type max_size)
generic_range_type< iterator > range_type
Concurrent vector container.
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.
Internal structure for compact()
A range over which to iterate.
vector_iterator(const vector_iterator< Container, typename Container::value_type > &other)
friend vector_iterator< C, T > operator+(ptrdiff_t offset, const vector_iterator< C, T > &v)
void move_assign(const void *src)
reference operator[](size_type index)
Get reference to element at given index.
const_reverse_iterator rend() const
reverse end const iterator
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.
const_reverse_iterator crend() const
reverse end const iterator
concurrent_vector(concurrent_vector &&source)
Move constructor.
pointer internal_push_back_result()
tbb::internal::allocator_rebind< A, T >::type allocator_type
element_construction_guard g
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
std::reverse_iterator< iterator > reverse_iterator
iterator grow_to_at_least(size_type n, const_reference t)
friend bool operator==(segment_value_t const &lhs, segment_allocation_failed)
void __TBB_EXPORTED_METHOD internal_copy(const concurrent_vector_base_v3 &src, size_type element_size, internal_array_op2 copy)
vector_iterator & operator++()
Pre increment.
const_range_type range(size_t grainsize=1) const
Get const range for iterating with parallel algorithms.
size_type __TBB_EXPORTED_METHOD internal_grow_by(size_type delta, size_type element_size, internal_array_op2 init, const void *src)
iterator begin()
start iterator
void move(tbb_thread &t1, tbb_thread &t2)
void const char const char int ITT_FORMAT __itt_group_sync p
range_type range(size_t grainsize=1)
Get range for iterating with parallel algorithms.
static void * internal_allocator(internal::concurrent_vector_base_v3 &vb, size_t k)
Allocate k items.
void store(void *allocated_segment_pointer) __TBB_NOEXCEPT(true)
Value * operator->() const
reverse_iterator rend()
reverse end iterator
allocator_type my_allocator
void internal_free_segments(segment_t table[], segment_index_t k, segment_index_t first_block)
Free k segments from table.
concurrent_vector(I first, I last, const allocator_type &a=allocator_type())
Construction with copying iteration range and given allocator instance.
const internal::concurrent_vector_base_v3 & internal_vector_base() const
bool empty() const
Return false if vector is not empty or has elements under construction at least.
static segment_index_t segment_base_index_of(segment_index_t &index)
Number of slots for segment pointers inside the class.
auto first(Container &c) -> decltype(begin(c))
vector_iterator(const Container &vector, size_t index, void *ptr=0)
auto last(Container &c) -> decltype(begin(c))
size_t my_index
Index into the vector.
T & internal_subscript(size_type index) const
Get reference to element at given index.
push_back_helper(concurrent_vector &vector)
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
reference front()
the first item
Container * my_vector
concurrent_vector over which we are iterating.
static size_type segment_size(segment_index_t k)
void move_construct(const void *src)
vector_iterator< Container, T > operator+(ptrdiff_t offset, const vector_iterator< Container, T > &v)
iterator push_back(const_reference item)
Push item.
bool operator>(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
friend bool operator==(const vector_iterator< C, T > &i, const vector_iterator< C, U > &j)
T & internal_subscript_with_exceptions(size_type index) const
Get reference to element at given index with errors checks.
Base class of concurrent vector implementation.
vector_iterator & operator-=(ptrdiff_t offset)
bool operator<=(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
segment_t(segment_t const &rhs)
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,...
concurrent_vector(const allocator_type &a=allocator_type())
Construct empty vector.
concurrent_vector(size_type n)
Construction with initial size specified by argument n.
atomic< size_type > my_first_block
count of segments in the first block
const_reverse_iterator crbegin() const
reverse start const iterator
__TBB_EXPORTED_METHOD ~concurrent_vector_base_v3()
ptrdiff_t difference_type
vector_iterator & operator=(const vector_iterator< Container, typename Container::value_type > &other)
segment_value_t load() const
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
vector_iterator operator+(ptrdiff_t offset) const
bool operator<=(const concurrent_vector< T, A1 > &a, const concurrent_vector< T, A2 > &b)
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...
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
concurrent_vector & operator=(const concurrent_vector< T, M > &vector)
Assignment for vector with different allocator type.
const_iterator cbegin() const
start const iterator
void reserve(size_type n)
Allocate enough space to grow to size n without having to allocate more memory later.
Value & operator[](ptrdiff_t k) const
void assign(I first, I last)
assign range [first, last)
generic_range_type(const generic_range_type< U > &r)
iterator grow_by(size_type delta)
Grow by "delta" elements.
static T * as_pointer(const void *src)
allocator_base(const allocator_type &a=allocator_type())
iterator grow_to_at_least(size_type n)
Append minimal sequence of elements such that size()>=n.
Meets requirements of a forward iterator for STL and a Value for a blocked_range.*/.
~element_construction_guard()
Value * my_item
Caches my_vector->internal_subscript(my_index)
void resize(size_type n, const_reference t)
Resize the vector, copy t for new elements. Not thread-safe.
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)
static const T * as_const_pointer(const void *ptr)
vector_iterator operator--(int)
Post decrement.
iterator grow_by(I first, I last)
void swap(segment_t &rhs)
void copy(const void *src)
void internal_assign_n(size_type n, const_pointer p)
assign n items by copying t
const_reference back() const
the last item const
iterator push_back(T &&item)
Push item, move-aware.
void internal_assign_range(I first, I last, is_integer_tag< false > *)
inline proxy assign by iterators
allocator_traits< Alloc >::template rebind_alloc< T >::other type
Class for determining type of std::allocator<T>::value_type.
void assign(const void *src)
iterator return_iterator_and_dismiss()
iterator grow_by(std::initializer_list< T > init_list)
concurrent_vector & operator=(concurrent_vector &&other)
Move assignment.
concurrent_vector_base_v3 concurrent_vector_base
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".
const_iterator end() const
One past last value in range.
void __TBB_EXPORTED_METHOD internal_swap(concurrent_vector_base_v3 &v)
atomic< size_type > my_early_size
Requested size of vector.
void *__TBB_EXPORTED_METHOD internal_push_back(size_type element_size, size_type &index)
Value & operator*() const
ptrdiff_t 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)
friend bool operator<(const vector_iterator< C, T > &i, const vector_iterator< C, U > &j)
size_type capacity() const
Maximum size to which array can grow without allocating more memory. Concurrent allocations are not i...
friend bool operator!=(segment_value_t const &lhs, argument_type arg)
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)
segment_index_t __TBB_EXPORTED_METHOD internal_clear(internal_array_op1 destroy)
const typedef T * const_pointer
internal::vector_iterator< concurrent_vector, const T > const_iterator
iterator emplace_back(Args &&... args)
Push item, create item "in place" with provided arguments.
const typedef T & const_reference
concurrent_vector(const concurrent_vector &vector, const allocator_type &a=allocator_type())
Copying constructor.
~concurrent_vector()
Clear and destroy vector.
concurrent_vector(const concurrent_vector< T, M > &vector, const allocator_type &a=allocator_type())
Copying constructor for vector with different allocator type.
allocator_type get_allocator() const
return allocator object
const typedef T & const_reference
void handle_unconstructed_elements(T *array, size_t n_of_elements)
Exception helper function.
reverse_iterator rbegin()
reverse start iterator
concurrent_vector_base_v3()
#define __TBB_EXPORTED_FUNC
vector_iterator & operator--()
Pre decrement.
Dummy type that distinguishes splitting constructor from copy constructor.
size_type grainsize() const
The grain size for this range.
static bool is_first_element_in_segment(size_type element_index)
vector_iterator operator-(ptrdiff_t offset) const
intptr_t __TBB_Log2(uintptr_t x)
generic_range_type(I begin_, I end_, size_t grainsize_=1)
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 ptrdiff_t operator-(const vector_iterator< C, T > &i, const vector_iterator< C, U > &j)
const_reference at(size_type index) const
Get const reference to element at given index. Throws exceptions on errors.
void allocator_move_assignment(MyAlloc &my_allocator, OtherAlloc &other_allocator, traits_true_type)
const_reference front() const
the first item const
segment_t & operator=(segment_t const &rhs)
static void __TBB_EXPORTED_FUNC initialize_array(void *begin, const void *, size_type n)
Construct n instances of T, starting at "begin".
static void __TBB_EXPORTED_FUNC destroy_array(void *begin, size_type n)
Destroy n instances of T, starting at "begin".
segment_index_t first_block
ptrdiff_t difference_type
void store(segment_not_used)
void throw_exception(exception_id eid)
Versionless convenience wrapper for throw_exception_v4()
reference at(size_type index)
Get reference to element at given index. Throws exceptions on errors.
std::random_access_iterator_tag iterator_category
size_type __TBB_EXPORTED_METHOD internal_capacity() const
generic_range_type< const_iterator > const_range_type
ptrdiff_t difference_type
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
bool operator>=(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
#define __TBB_NOEXCEPT(expression)
const_iterator begin() const
Beginning of range.
atomic< segment_t * > my_segment
Pointer to the segments table.
size_type size() const
Return size of vector. It may include elements under construction.
static segment_index_t segment_base(segment_index_t k)
void internal_grow(size_type start, size_type finish, size_type element_size, internal_array_op2 init, const void *src)
concurrent_vector & operator=(const concurrent_vector &vector)
Assignment.
vector_iterator & operator+=(ptrdiff_t offset)
void allocator_swap(MyAlloc &my_allocator, OtherAlloc &other_allocator, traits_true_type)
void const char const char int ITT_FORMAT __itt_group_sync s
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.
bool operator==(const cache_aligned_allocator< T > &, const cache_aligned_allocator< U > &)
void swap(atomic< T > &lhs, atomic< T > &rhs)
bool operator!=(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
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.
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.
generic_range_type(generic_range_type &r, split)
void swap(concurrent_hash_map< Key, T, HashCompare, A > &a, concurrent_hash_map< Key, T, HashCompare, A > &b)
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)
#define __TBB_EXPORTED_METHOD
vector_iterator operator++(int)
Post increment.
internal::vector_iterator< concurrent_vector, T > iterator
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".
static void *const vector_allocation_error_flag
Bad allocation marker.
friend void swap(segment_t &, segment_t &) __TBB_NOEXCEPT(true)
std::reverse_iterator< const_iterator > const_reverse_iterator
segment_value_t(void *an_array)
void store(segment_allocation_failed)
void resize(size_type n)
Resize the vector. Not thread-safe.
void *__TBB_EXPORTED_METHOD internal_compact(size_type element_size, void *table, internal_array_op1 destroy, internal_array_op2 copy)
static segment_index_t segment_index_of(size_type index)
reference back()
the last item
Base class for types that should not be copied or assigned.
void init(const void *src)
Exception-aware helper class for filling a segment by exception-danger operators of user class.
internal::concurrent_vector_base_v3::size_type size_type
void clear()
Clear container while keeping memory allocated.
element_construction_guard(pointer an_element)
void *(* vector_allocator_ptr)(concurrent_vector_base_v3 &, size_t)
allocator function pointer
const_reverse_iterator rbegin() const
reverse start const iterator
const_iterator cend() const
end const iterator
void swap(concurrent_vector &vector)
swap two instances
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)
friend void enforce_segment_allocated(segment_value_t const &s, internal::exception_id exception=eid_bad_last_alloc)
bool operator>(const concurrent_vector< T, A1 > &a, const concurrent_vector< T, A2 > &b)
const_iterator end() const
end const iterator
friend bool operator==(segment_value_t const &lhs, segment_allocated)
internal_loop_guide(size_type ntrials, void *ptr)
segment_t my_storage[pointers_per_short_table]
embedded storage of segment pointers
friend bool operator==(segment_value_t const &lhs, segment_not_used)
segment_t table[pointers_per_long_table]
iterator end()
end iterator
Copyright © 2005-2019 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.