79 intmax_t subq = -1) = 0;
117 template <
typename ContainerT,
size_t... Idx>
119 ->
decltype(std::make_tuple(std::forward<ContainerT>(container)[Idx]...))
121 return std::make_tuple(std::forward<ContainerT>(container)[Idx]...);
124 template <std::
size_t N,
typename ContainerT>
133 template <std::size_t N, std::size_t Nt,
typename TupleT,
137 if(std::get<N>(_t).get())
138 (*(std::get<N>(_t)))();
141 template <std::size_t N, std::size_t Nt,
typename TupleT,
145 if(std::get<N>(_t).
get())
146 (*(std::get<N>(_t)))();
147 TExecutor<N + 1, Nt, TupleT>(std::forward<TupleT>(_t));
150 template <
typename TupleT, std::
size_t N = std::tuple_size<decay_t<TupleT>>::value>
153 TExecutor<0, N - 1, TupleT>(std::forward<TupleT>(__t));
156 template <
typename Container,
157 typename std::enable_if<std::is_same<Container, task_pointer>::value,
165 template <
typename Container,
166 typename std::enable_if<!std::is_same<Container, task_pointer>::value,
181 auto compute = (n > max_n) ? max_n : n;
185 auto t = ContainerToTuple<4>(tasks);
190 auto t = ContainerToTuple<3>(tasks);
195 auto t = ContainerToTuple<2>(tasks);
200 auto t = ContainerToTuple<1>(tasks);
VTask is the abstract class stored in thread_pool.
virtual void ExecuteOnSpecificThreads(ThreadIdSet tid_set, ThreadPool *tp, function_type f)=0
virtual task_pointer GetTask(intmax_t subq=-1, intmax_t nitr=-1)=0
virtual size_type true_size() const
static void TExecutor(TupleT &&_t)
virtual intmax_t InsertTask(task_pointer, ThreadData *=nullptr, intmax_t subq=-1)=0
virtual size_type bin_size(size_type bin) const =0
std::atomic< intmax_t > AtomicInt
static auto ContainerToTupleImpl(ContainerT &&container, mpl::index_sequence< Idx... >) -> decltype(std::make_tuple(std::forward< ContainerT >(container)[Idx]...))
virtual void ExecuteOnAllThreads(ThreadPool *tp, function_type f)=0
virtual bool empty() const =0
virtual ~VUserTaskQueue()
virtual void resize(intmax_t)=0
static auto ContainerToTuple(ContainerT &&container) -> decltype(ContainerToTupleImpl(std::forward< ContainerT >(container), mpl::make_index_sequence< N >{}))
static void Execute(Container &obj)
static void Execute(Container &tasks)
static void Executor(TupleT &&__t)
virtual VUserTaskQueue * clone()=0
std::set< ThreadId > ThreadIdSet
virtual size_type size() const =0
virtual intmax_t GetThreadBin() const =0
virtual bool bin_empty(size_type bin) const =0
std::function< void()> function_type
virtual bool true_empty() const
impl::make_integer_sequence< size_t, NumT > make_index_sequence
Alias template make_index_sequence.
auto get(Tuple< Elements... > &t) -> decltype(get_height< sizeof...(Elements) - I - 1 >(t))
typename std::enable_if< B, T >::type enable_if_t
Class template integer_sequence.