Warning, file /include/oneapi/tbb/combinable.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef __TBB_combinable_H
0018 #define __TBB_combinable_H
0019
0020 #include "detail/_namespace_injection.h"
0021
0022 #include "enumerable_thread_specific.h"
0023 #include "cache_aligned_allocator.h"
0024
0025 namespace tbb {
0026 namespace detail {
0027 namespace d1 {
0028
0029
0030
0031
0032 template <typename T>
0033 class combinable {
0034 using my_alloc = typename tbb::cache_aligned_allocator<T>;
0035 using my_ets_type = typename tbb::enumerable_thread_specific<T, my_alloc, ets_no_key>;
0036 my_ets_type my_ets;
0037
0038 public:
0039 combinable() = default;
0040
0041 template <typename Finit>
0042 explicit combinable(Finit _finit) : my_ets(_finit) { }
0043
0044 void clear() { my_ets.clear(); }
0045
0046 T& local() { return my_ets.local(); }
0047
0048 T& local(bool& exists) { return my_ets.local(exists); }
0049
0050
0051 template <typename CombineFunc>
0052 T combine(CombineFunc f_combine) { return my_ets.combine(f_combine); }
0053
0054
0055 template <typename CombineFunc>
0056 void combine_each(CombineFunc f_combine) { my_ets.combine_each(f_combine); }
0057 };
0058
0059 }
0060 }
0061
0062 inline namespace v1 {
0063 using detail::d1::combinable;
0064 }
0065
0066 }
0067
0068 #endif
0069