21 #ifndef __TBB_enumerable_thread_specific_H 22 #define __TBB_enumerable_thread_specific_H 41 #define __TBB_ETS_USE_CPP11 \ 42 (__TBB_CPP11_RVALUE_REF_PRESENT && __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT \ 43 && __TBB_CPP11_DECLTYPE_PRESENT && __TBB_CPP11_LAMBDAS_PRESENT) 50 namespace interface6 {
53 template <
typename T,
typename Allocator, ets_key_usage_type ETS_key_type>
61 template<ets_key_usage_type ETS_key_type>
65 #if __TBB_PROTECTED_NESTED_CLASS_BROKEN 73 slot& at(
size_t k ) {
74 return ((slot*)(
void*)(
this+1))[k];
76 size_t size()
const {
return size_t(1)<<lg_size;}
77 size_t mask()
const {
return size()-1;}
78 size_t start(
size_t h )
const {
79 return h>>(8*
sizeof(size_t)-lg_size);
85 bool empty()
const {
return key == key_type();}
86 bool match( key_type k )
const {
return key == k;}
87 bool claim( key_type k ) {
89 return atomic_compare_and_swap(
key, k, key_type()) == key_type();
92 #if __TBB_PROTECTED_NESTED_CLASS_BROKEN 99 atomic<array*> my_root;
100 atomic<size_t> my_count;
101 virtual void* create_local() = 0;
102 virtual void* create_array(
size_t _size) = 0;
103 virtual void free_array(
void* ptr,
size_t _size) = 0;
104 array* allocate(
size_t lg_size ) {
105 size_t n = size_t(1)<<lg_size;
106 array* a = static_cast<array*>(create_array(
sizeof(array)+n*
sizeof(slot) ));
107 a->lg_size = lg_size;
108 std::memset( a+1, 0, n*
sizeof(slot) );
111 void free(array* a) {
112 size_t n = size_t(1)<<(a->lg_size);
113 free_array( (
void *)a,
size_t(
sizeof(array)+n*
sizeof(slot)) );
116 ets_base() {my_root=NULL; my_count=0;}
118 void* table_lookup(
bool& exists );
122 void table_elementwise_copy(
const ets_base& other,
123 void*(*add_element)(ets_base&,
void*) ) {
126 if( !other.my_root )
return;
127 array* root = my_root = allocate(other.my_root->lg_size);
129 my_count = other.my_count;
130 size_t mask = root->mask();
131 for( array* r=other.my_root; r; r=r->next ) {
132 for(
size_t i=0; i<r->size(); ++i ) {
136 slot& s2 = root->at(j);
138 s2.ptr = add_element(*
this, s1.ptr);
142 else if( s2.match(s1.key) )
149 void table_swap( ets_base& other ) {
150 __TBB_ASSERT(
this!=&other,
"Don't swap an instance with itself");
151 tbb::internal::swap<relaxed>(my_root, other.my_root);
152 tbb::internal::swap<relaxed>(my_count, other.my_count);
156 template<ets_key_usage_type ETS_key_type>
157 ets_base<ETS_key_type>::~ets_base() {
161 template<ets_key_usage_type ETS_key_type>
162 void ets_base<ETS_key_type>::table_clear() {
163 while( array* r = my_root ) {
170 template<ets_key_usage_type ETS_key_type>
171 void* ets_base<ETS_key_type>::table_lookup(
bool& exists ) {
177 for( array* r=my_root; r; r=r->next ) {
179 size_t mask=r->mask();
180 for(
size_t i = r->start(
h); ;i=(i+1)&
mask) {
182 if(
s.empty() )
break;
201 found = create_local();
203 size_t c = ++my_count;
206 if( !r || c>r->size()/2 ) {
207 size_t s = r ? r->lg_size : 2;
208 while( c>
size_t(1)<<(
s-1) ) ++
s;
209 array* a = allocate(
s);
213 array* new_r = my_root.compare_and_swap(a,r);
214 if( new_r==r )
break;
216 if( new_r->lg_size>=
s ) {
231 size_t mask = ir->mask();
232 for(
size_t i = ir->start(
h);;i=(i+1)&
mask) {
246 typedef ets_base<ets_no_key> super;
248 #if __TBB_WIN8UI_SUPPORT 249 typedef DWORD tls_key_t;
250 void create_key() { my_key = FlsAlloc(NULL); }
251 void destroy_key() { FlsFree(my_key); }
252 void set_tls(
void *
value) { FlsSetValue(my_key, (LPVOID)
value); }
253 void* get_tls() {
return (
void *)FlsGetValue(my_key); }
255 typedef DWORD tls_key_t;
256 void create_key() { my_key = TlsAlloc(); }
257 void destroy_key() { TlsFree(my_key); }
258 void set_tls(
void *
value) { TlsSetValue(my_key, (LPVOID)
value); }
259 void* get_tls() {
return (
void *)TlsGetValue(my_key); }
262 typedef pthread_key_t tls_key_t;
263 void create_key() { pthread_key_create(&my_key, NULL); }
264 void destroy_key() { pthread_key_delete(my_key); }
265 void set_tls(
void *
value )
const { pthread_setspecific(my_key,
value); }
266 void* get_tls()
const {
return pthread_getspecific(my_key); }
271 virtual
void free_array(
void* ptr,
size_t _size)
__TBB_override = 0;
273 ets_base() {create_key();}
274 ~ets_base() {destroy_key();}
275 void* table_lookup(
bool& exists ) {
276 void* found = get_tls();
280 found = super::table_lookup(exists);
288 super::table_clear();
290 void table_swap( ets_base& other ) {
292 __TBB_ASSERT(
this!=&other,
"Don't swap an instance with itself");
293 swap(my_key, other.my_key);
294 super::table_swap(other);
299 template<
typename Container,
typename Value >
300 class enumerable_thread_specific_iterator
301 #if defined(_WIN64) && defined(_MSC_VER)
303 : public std::iterator<std::random_access_iterator_tag,Value>
308 Container *my_container;
309 typename Container::size_type my_index;
310 mutable Value *my_value;
312 template<
typename C,
typename T>
313 friend enumerable_thread_specific_iterator<C,T>
314 operator+( ptrdiff_t offset,
const enumerable_thread_specific_iterator<C,T>& v );
316 template<
typename C,
typename T,
typename U>
317 friend bool operator==(
const enumerable_thread_specific_iterator<C,T>& i,
318 const enumerable_thread_specific_iterator<C,U>& j );
320 template<
typename C,
typename T,
typename U>
321 friend bool operator<(
const enumerable_thread_specific_iterator<C,T>& i,
322 const enumerable_thread_specific_iterator<C,U>& j );
324 template<
typename C,
typename T,
typename U>
325 friend ptrdiff_t
operator-(
const enumerable_thread_specific_iterator<C,T>& i,
326 const enumerable_thread_specific_iterator<C,U>& j );
328 template<
typename C,
typename U>
329 friend class enumerable_thread_specific_iterator;
333 enumerable_thread_specific_iterator(
const Container &container,
typename Container::size_type index ) :
334 my_container(&const_cast<Container &>(container)), my_index(index), my_value(NULL) {}
337 enumerable_thread_specific_iterator() : my_container(NULL), my_index(0), my_value(NULL) {}
340 enumerable_thread_specific_iterator(
const enumerable_thread_specific_iterator<Container, U>& other ) :
341 my_container( other.my_container ), my_index( other.my_index), my_value( const_cast<Value *>(other.my_value) ) {}
343 enumerable_thread_specific_iterator
operator+( ptrdiff_t offset )
const {
344 return enumerable_thread_specific_iterator(*my_container, my_index + offset);
347 enumerable_thread_specific_iterator &operator+=( ptrdiff_t offset ) {
353 enumerable_thread_specific_iterator
operator-( ptrdiff_t offset )
const {
354 return enumerable_thread_specific_iterator( *my_container, my_index-offset );
357 enumerable_thread_specific_iterator &operator-=( ptrdiff_t offset ) {
363 Value& operator*()
const {
364 Value*
value = my_value;
366 value = my_value = (*my_container)[my_index].value();
372 Value& operator[]( ptrdiff_t k )
const {
373 return (*my_container)[my_index + k].value;
376 Value* operator->()
const {
return &operator*();}
378 enumerable_thread_specific_iterator& operator++() {
384 enumerable_thread_specific_iterator& operator--() {
391 enumerable_thread_specific_iterator operator++(
int) {
392 enumerable_thread_specific_iterator result = *
this;
399 enumerable_thread_specific_iterator operator--(
int) {
400 enumerable_thread_specific_iterator result = *
this;
407 typedef ptrdiff_t difference_type;
408 typedef Value value_type;
409 typedef Value* pointer;
410 typedef Value& reference;
411 typedef std::random_access_iterator_tag iterator_category;
414 template<
typename Container,
typename T>
415 enumerable_thread_specific_iterator<Container,T>
416 operator+( ptrdiff_t offset,
const enumerable_thread_specific_iterator<Container,T>& v ) {
417 return enumerable_thread_specific_iterator<Container,T>( v.my_container, v.my_index + offset );
420 template<
typename Container,
typename T,
typename U>
421 bool operator==(
const enumerable_thread_specific_iterator<Container,T>& i,
422 const enumerable_thread_specific_iterator<Container,U>& j ) {
423 return i.my_index==j.my_index && i.my_container == j.my_container;
426 template<
typename Container,
typename T,
typename U>
427 bool operator!=(
const enumerable_thread_specific_iterator<Container,T>& i,
428 const enumerable_thread_specific_iterator<Container,U>& j ) {
432 template<
typename Container,
typename T,
typename U>
433 bool operator<(
const enumerable_thread_specific_iterator<Container,T>& i,
434 const enumerable_thread_specific_iterator<Container,U>& j ) {
435 return i.my_index<j.my_index;
438 template<
typename Container,
typename T,
typename U>
439 bool operator>(
const enumerable_thread_specific_iterator<Container,T>& i,
440 const enumerable_thread_specific_iterator<Container,U>& j ) {
444 template<
typename Container,
typename T,
typename U>
445 bool operator>=(
const enumerable_thread_specific_iterator<Container,T>& i,
446 const enumerable_thread_specific_iterator<Container,U>& j ) {
450 template<
typename Container,
typename T,
typename U>
451 bool operator<=(
const enumerable_thread_specific_iterator<Container,T>& i,
452 const enumerable_thread_specific_iterator<Container,U>& j ) {
456 template<
typename Container,
typename T,
typename U>
457 ptrdiff_t
operator-(
const enumerable_thread_specific_iterator<Container,T>& i,
458 const enumerable_thread_specific_iterator<Container,U>& j ) {
459 return i.my_index-j.my_index;
462 template<
typename SegmentedContainer,
typename Value >
463 class segmented_iterator
464 #if defined(_WIN64) && defined(_MSC_VER)
465 : public std::iterator<std::input_iterator_tag, Value>
468 template<
typename C,
typename T,
typename U>
469 friend bool operator==(
const segmented_iterator<C,T>& i,
const segmented_iterator<C,U>& j);
471 template<
typename C,
typename T,
typename U>
472 friend bool operator!=(
const segmented_iterator<C,T>& i,
const segmented_iterator<C,U>& j);
474 template<
typename C,
typename U>
475 friend class segmented_iterator;
479 segmented_iterator() {my_segcont = NULL;}
481 segmented_iterator(
const SegmentedContainer& _segmented_container ) :
482 my_segcont(const_cast<SegmentedContainer*>(&_segmented_container)),
483 outer_iter(my_segcont->
end()) { }
485 ~segmented_iterator() {}
487 typedef typename SegmentedContainer::iterator outer_iterator;
488 typedef typename SegmentedContainer::value_type InnerContainer;
489 typedef typename InnerContainer::iterator inner_iterator;
492 typedef ptrdiff_t difference_type;
493 typedef Value value_type;
494 typedef typename SegmentedContainer::size_type size_type;
495 typedef Value* pointer;
496 typedef Value& reference;
497 typedef std::input_iterator_tag iterator_category;
501 segmented_iterator(
const segmented_iterator<SegmentedContainer, U>& other) :
502 my_segcont(other.my_segcont),
503 outer_iter(other.outer_iter),
505 inner_iter(other.inner_iter)
510 segmented_iterator& operator=(
const segmented_iterator<SegmentedContainer, U>& other) {
512 my_segcont = other.my_segcont;
513 outer_iter = other.outer_iter;
514 if(outer_iter != my_segcont->end()) inner_iter = other.inner_iter;
522 segmented_iterator& operator=(
const outer_iterator& new_outer_iter) {
525 for(outer_iter = new_outer_iter ;outer_iter!=my_segcont->end(); ++outer_iter) {
526 if( !outer_iter->empty() ) {
527 inner_iter = outer_iter->begin();
535 segmented_iterator& operator++() {
541 segmented_iterator operator++(
int) {
542 segmented_iterator tmp = *
this;
547 bool operator==(
const outer_iterator& other_outer)
const {
549 return (outer_iter == other_outer &&
550 (outer_iter == my_segcont->end() || inner_iter == outer_iter->begin()));
553 bool operator!=(
const outer_iterator& other_outer)
const {
559 reference operator*()
const {
561 __TBB_ASSERT(outer_iter != my_segcont->end(),
"Dereferencing a pointer at end of container");
567 pointer operator->()
const {
return &operator*();}
570 SegmentedContainer* my_segcont;
571 outer_iterator outer_iter;
572 inner_iterator inner_iter;
579 while(inner_iter == outer_iter->end() && ++outer_iter != my_segcont->end()) {
580 inner_iter = outer_iter->begin();
585 template<
typename SegmentedContainer,
typename T,
typename U>
586 bool operator==(
const segmented_iterator<SegmentedContainer,T>& i,
587 const segmented_iterator<SegmentedContainer,U>& j ) {
588 if(i.my_segcont != j.my_segcont)
return false;
589 if(i.my_segcont == NULL)
return true;
590 if(i.outer_iter != j.outer_iter)
return false;
591 if(i.outer_iter == i.my_segcont->end())
return true;
592 return i.inner_iter == j.inner_iter;
596 template<
typename SegmentedContainer,
typename T,
typename U>
597 bool operator!=(
const segmented_iterator<SegmentedContainer,T>& i,
598 const segmented_iterator<SegmentedContainer,U>& j ) {
604 void construct(
void*where) {
new(where) T();}
605 construct_by_default(
int ) {}
611 void construct(
void*where) {
new(where) T(exemplar);}
612 construct_by_exemplar(
const T& t ) : exemplar(t) {}
613 #if __TBB_ETS_USE_CPP11 614 construct_by_exemplar( T&& t ) : exemplar(std::
move(t)) {}
618 template<
typename T,
typename Finit>
621 void construct(
void* where) {
new(where) T(f());}
622 construct_by_finit(
const Finit& f_ ) : f(f_) {}
623 #if __TBB_ETS_USE_CPP11 624 construct_by_finit( Finit&& f_ ) : f(std::
move(f_)) {}
628 #if __TBB_ETS_USE_CPP11 629 template<
typename T,
typename... P>
631 internal::stored_pack<P...> pack;
632 void construct(
void* where) {
634 new(where) T(args...);
637 construct_by_args( P&& ... args ) : pack(std::forward<P>(args)...) {}
644 class callback_base {
647 virtual callback_base* clone()
const = 0;
649 virtual void destroy() = 0;
651 virtual ~callback_base() { }
653 virtual void construct(
void* where) = 0;
656 template <
typename T,
typename Constructor>
657 class callback_leaf:
public callback_base<T>, Constructor {
658 #if __TBB_ETS_USE_CPP11 659 template<
typename... P> callback_leaf( P&& ... params ) : Constructor(std::forward<P>(params)...) {}
661 template<
typename X> callback_leaf(
const X& x ) : Constructor(x) {}
671 my_allocator_type().destroy(
this);
672 my_allocator_type().deallocate(
this,1);
676 Constructor::construct(where);
679 #if __TBB_ETS_USE_CPP11 680 template<
typename... P>
681 static callback_base<T>* make( P&& ... params ) {
682 void* where = my_allocator_type().allocate(1);
683 return new(where) callback_leaf( std::forward<P>(params)... );
687 static callback_base<T>* make(
const X& x ) {
688 void* where = my_allocator_type().allocate(1);
689 return new(where) callback_leaf(x);
707 ets_element() { is_built =
false; }
709 U* value_committed() { is_built =
true;
return my_space.
begin(); }
712 my_space.
begin()->~U();
721 template<
typename T,
typename ETS>
struct is_compatible_ets {
static const bool value =
false; };
722 template<
typename T,
typename U,
typename A, ets_key_usage_type C>
725 #if __TBB_ETS_USE_CPP11 727 template <
typename T>
728 class is_callable_no_args {
733 template<
typename U>
static yes& decide( decltype(declval<U>()())* );
734 template<
typename U>
static no& decide(...);
736 static const bool value = (
sizeof(decide<T>(NULL)) ==
sizeof(yes));
763 template <
typename T,
764 typename Allocator=cache_aligned_allocator<T>,
766 class enumerable_thread_specific: internal::ets_base<ETS_key_type> {
798 my_construct_callback->construct(lref.value());
799 return lref.value_committed();
805 new(lref.value()) T(*static_cast<T*>(
p));
806 return lref.value_committed();
809 #if __TBB_ETS_USE_CPP11 813 new(lref.value()) T(
std::move(*static_cast<T*>(
p)));
814 return lref.value_committed();
822 size_t nelements = (_size +
sizeof(uintptr_t) -1) /
sizeof(uintptr_t);
827 size_t nelements = (_size +
sizeof(uintptr_t) -1) /
sizeof(uintptr_t);
844 typedef typename internal::enumerable_thread_specific_iterator< internal_collection_type, value_type >
iterator;
845 typedef typename internal::enumerable_thread_specific_iterator< internal_collection_type, const value_type >
const_iterator;
853 internal::callback_leaf<T,internal::construct_by_default<T> >::make(0)
857 template <
typename Finit
858 #if __TBB_ETS_USE_CPP11 863 internal::callback_leaf<T,internal::construct_by_finit<T,Finit> >::make(
tbb::internal::
move(finit) )
868 internal::callback_leaf<T,internal::construct_by_exemplar<T> >::make( exemplar )
871 #if __TBB_ETS_USE_CPP11 873 internal::callback_leaf<T,internal::construct_by_exemplar<T> >::make( std::
move(exemplar) )
877 template <
typename P1,
typename... P,
883 internal::callback_leaf<T,internal::construct_by_args<T,P1,P...> >::make( std::forward<P1>(arg1), std::forward<P>(args)... )
889 if(my_construct_callback) my_construct_callback->destroy();
891 this->internal::ets_base<ets_no_key>::table_clear();
897 return local(exists);
902 void* ptr = this->table_lookup(exists);
938 template<
typename A2, ets_key_usage_type C2>
940 #if __TBB_ETS_USE_CPP11 && TBB_USE_ASSERT 942 __TBB_STATIC_ASSERT( (internal::is_compatible_ets<T,
typename internal::strip<decltype(other)>::
type>::
value),
"is_compatible_ets fails" );
945 my_construct_callback = other.my_construct_callback->clone();
947 my_locals.
reserve(other.size());
948 this->table_elementwise_copy( other, create_local_by_copy );
954 swap(my_construct_callback, other.my_construct_callback);
957 swap(my_locals, other.my_locals);
958 this->internal::ets_base<ETS_key_type>::table_swap(other);
961 #if __TBB_ETS_USE_CPP11 962 template<
typename A2, ets_key_usage_type C2>
966 __TBB_STATIC_ASSERT( (internal::is_compatible_ets<T,
typename internal::strip<decltype(other)>::
type>::
value),
"is_compatible_ets fails" );
968 my_construct_callback = other.my_construct_callback;
969 other.my_construct_callback = NULL;
971 my_locals.
reserve(other.size());
972 this->table_elementwise_copy( other, create_local_by_move );
979 : internal::ets_base<ETS_key_type>()
981 internal_copy(other);
984 template<
typename Alloc, ets_key_usage_type Cachetype>
987 internal_copy(other);
990 #if __TBB_ETS_USE_CPP11 993 internal_swap(other);
996 template<
typename Alloc, ets_key_usage_type Cachetype>
1005 if(
this != &other ) {
1007 my_construct_callback->destroy();
1008 internal_copy( other );
1013 template<
typename Alloc, ets_key_usage_type Cachetype>
1016 __TBB_ASSERT( static_cast<void*>(
this)!=static_cast<const void*>(&other), NULL );
1018 my_construct_callback->destroy();
1019 internal_copy(other);
1023 #if __TBB_ETS_USE_CPP11 1026 if(
this != &other )
1027 internal_swap(other);
1031 template<
typename Alloc, ets_key_usage_type Cachetype>
1034 __TBB_ASSERT( static_cast<void*>(
this)!=static_cast<const void*>(&other), NULL );
1036 my_construct_callback->destroy();
1043 template <
typename combine_func_t>
1046 internal::ets_element<T> location;
1047 my_construct_callback->construct(location.value());
1048 return *location.value_committed();
1052 while(++ci !=
end())
1053 my_result = f_combine( my_result, *ci );
1058 template <
typename combine_func_t>
1067 template<
typename Container >
1085 typedef typename internal::segmented_iterator<Container, value_type>
iterator;
1086 typedef typename internal::segmented_iterator<Container, const value_type>
const_iterator;
1088 flattened2d(
const Container &c,
typename Container::const_iterator b,
typename Container::const_iterator e ) :
1089 my_container(const_cast<Container*>(&c)), my_begin(b), my_end(e) { }
1092 my_container(const_cast<Container*>(&c)), my_begin(c.
begin()), my_end(c.
end()) { }
1101 for(
typename Container::const_iterator i = my_begin; i != my_end; ++i) {
1102 tot_size += i->size();
1115 template <
typename Container>
1120 template <
typename Container>
1127 namespace internal {
1128 using interface6::internal::segmented_iterator;
1131 using interface6::enumerable_thread_specific;
1132 using interface6::flattened2d;
bool operator<=(const concurrent_vector< T, A1 > &a, const concurrent_vector< T, A2 > &b)
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 end
const T & const_reference
void reserve(size_type n)
Allocate enough space to grow to size n without having to allocate more memory later.
conval_type::size_type size_type
Basic types.
generic_range_type(const generic_range_type< U > &r)
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 h
void internal_copy(const enumerable_thread_specific< T, A2, C2 > &other)
conval_type::reference reference
bool operator>=(const concurrent_vector< T, A1 > &a, const concurrent_vector< T, A2 > &b)
generic_range_type< const_iterator > const_range_type
enumerable_thread_specific & operator=(enumerable_thread_specific &&other)
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 id
internal::padded< internal::ets_element< T > > padded_element
T * begin() const
Pointer to beginning of array.
iterator end()
end iterator
enumerable_thread_specific(const enumerable_thread_specific< T, Alloc, Cachetype > &other)
A range over which to iterate.
#define __TBB_STATIC_ASSERT(condition, msg)
flattened2d(const Container &c, typename Container::const_iterator b, typename Container::const_iterator e)
ets_key_usage_type
enum for selecting between single key and key-per-instance versions
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
internal_collection_type::size_type size_type
reference local()
returns reference to local, discarding exists
bool operator<(const concurrent_vector< T, A1 > &a, const concurrent_vector< T, A2 > &b)
tick_count::interval_t operator-(const tick_count &t1, const tick_count &t0)
enumerable_thread_specific(const T &exemplar)
Constructor with exemplar. Each local instance of T is copy-constructed from the exemplar.
enumerable_thread_specific(enumerable_thread_specific< T, Alloc, Cachetype > &&other)
internal::segmented_iterator< Container, value_type > iterator
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
void internal_swap(enumerable_thread_specific &other)
Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5.
const_iterator end() const
end const iterator
conval_type::value_type value_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 __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 ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type type
Base class for types that should not be copied or assigned.
bool operator>(const concurrent_vector< T, A1 > &a, const concurrent_vector< T, A2 > &b)
~enumerable_thread_specific()
Destructor.
void swap(atomic< T > &lhs, atomic< T > &rhs)
const_iterator begin() const
begin const iterator
A generic range, used to create range objects from the iterators.
conval_type::pointer pointer
void internal_move(enumerable_thread_specific< T, A2, C2 > &&other)
ptrdiff_t difference_type
generic_range_type(I begin_, I end_, size_t grainsize_=1)
Container::const_iterator my_end
iterator begin()
begin iterator
generic_range_type< iterator > range_type
vector_iterator< Container, T > operator+(ptrdiff_t offset, const vector_iterator< Container, T > &v)
void const char const char int ITT_FORMAT __itt_group_sync p
Allocator allocator_type
Basic types.
Base class for types that should not be assigned.
reference local(bool &exists)
Returns reference to calling thread's local copy, creating one if necessary.
internal::enumerable_thread_specific_iterator< internal_collection_type, const value_type > const_iterator
bool empty() const
true if there have been no local copies created
enumerable_thread_specific(Finit finit)
Constructor with initializer functor. Each local instance of T is constructed by T(finit()).
tbb::concurrent_vector< padded_element, padded_allocator_type > internal_collection_type
void free_array(void *_ptr, size_t _size) __TBB_override
Allocator::template rebind< padded_element >::other padded_allocator_type
enumerable_thread_specific(P1 &&arg1, P &&... args)
Variadic constructor with initializer arguments. Each local instance of T is constructed by T(args....
range_type range(size_t grainsize=1)
Get range for parallel algorithms.
void * create_local() __TBB_override
bool operator!=(const memory_pool_allocator< T, P > &a, const memory_pool_allocator< U, P > &b)
ptrdiff_t difference_type
flattened2d(const Container &c)
conval_type::const_pointer const_pointer
const_range_type range(size_t grainsize=1) const
Get const range for parallel algorithms.
static void * create_local_by_copy(internal::ets_base< ets_no_key > &base, void *p)
void swap(concurrent_hash_map< Key, T, HashCompare, A > &a, concurrent_hash_map< Key, T, HashCompare, A > &b)
internal_collection_type::difference_type difference_type
enumerable_thread_specific(T &&exemplar)
conval_type::difference_type difference_type
Allocator::template rebind< uintptr_t >::other array_allocator_type
size_type size() const
Get the number of local copies.
conval_type::const_reference const_reference
Dummy type that distinguishes splitting constructor from copy constructor.
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
void call(F &&f, Pack &&p)
Calls the given function with arguments taken from a stored_pack.
void call_itt_notify(notify_type, void *)
void combine_each(combine_func_t f_combine)
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 ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle * key
generic_range_type(generic_range_type &r, split)
const T & const_reference
Container::const_iterator my_begin
enumerable_thread_specific(const enumerable_thread_specific &other)
enumerable_thread_specific & operator=(enumerable_thread_specific< T, Alloc, Cachetype > &&other)
conval_type::allocator_type allocator_type
void move(tbb_thread &t1, tbb_thread &t2)
bool empty() const
Return false if vector is not empty or has elements under construction at least.
void const char const char int ITT_FORMAT __itt_group_sync s
internal::concurrent_vector_base_v3::size_type size_type
void clear()
Destroys local copies.
internal::callback_base< T > * my_construct_callback
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 size
enumerable_thread_specific & operator=(const enumerable_thread_specific &other)
flattened2d< Container > flatten2d(const Container &c, const typename Container::const_iterator b, const typename Container::const_iterator e)
const_iterator begin() const
internal_collection_type my_locals
T combine(combine_func_t f_combine)
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 mask
bool operator==(const memory_pool_allocator< T, P > &a, const memory_pool_allocator< U, P > &b)
size_type size() const
Return size of vector. It may include elements under construction.
enumerable_thread_specific(enumerable_thread_specific &&other)
static void * create_local_by_move(internal::ets_base< ets_no_key > &base, void *p)
void * create_array(size_t _size) __TBB_override
internal::enumerable_thread_specific_iterator< internal_collection_type, value_type > iterator
iterator grow_by(size_type delta)
Grow by "delta" elements.
The enumerable_thread_specific container.
Identifiers declared inside namespace internal should never be used directly by client code.
Block of space aligned sufficiently to construct an array T with N elements.
const_iterator end() const
enumerable_thread_specific & operator=(const enumerable_thread_specific< T, Alloc, Cachetype > &other)
internal::segmented_iterator< Container, const value_type > const_iterator
enumerable_thread_specific()
Default constructor. Each local instance of T is default constructed.
Container::value_type conval_type
void clear()
Clear container while keeping memory allocated.