tf::StaticPartitioner tf::PartitionerBase< DefaultClosureWrapper > taskflow/algorithm/partitioner.hpp typename C DefaultClosureWrapper constexpr PartitionerType static constexpr PartitionerType tf::StaticPartitioner< C >::type () type queries the partition type (static) tf::StaticPartitioner< C >::StaticPartitioner ()=default StaticPartitioner default constructor tf::StaticPartitioner< C >::StaticPartitioner (size_t sz) StaticPartitioner size_t sz construct a static partitioner with the given chunk size tf::StaticPartitioner< C >::StaticPartitioner (size_t sz, C &&closure) StaticPartitioner size_t sz C && closure construct a static partitioner with the given chunk size and the closure size_t size_t tf::StaticPartitioner< C >::adjusted_chunk_size (size_t N, size_t W, size_t w) const adjusted_chunk_size size_t N size_t W size_t w queries the adjusted chunk size Returns the given chunk size if it is not zero, or returns N/W + (w < NW), where N is the number of iterations, W is the number of workers, and w is the worker ID. typename F std::enable_if_t< std::is_invocable_r_v< void, F, size_t, size_t >, void > * nullptr void void tf::StaticPartitioner< C >::loop (size_t N, size_t W, size_t curr_b, size_t chunk_size, F &&func) loop size_t N size_t W size_t curr_b size_t chunk_size F && func typename F std::enable_if_t< std::is_invocable_r_v< bool, F, size_t, size_t >, void > * nullptr void void tf::StaticPartitioner< C >::loop_until (size_t N, size_t W, size_t curr_b, size_t chunk_size, F &&func) loop_until size_t N size_t W size_t curr_b size_t chunk_size F && func class to construct a static partitioner for scheduling parallel algorithms C closure wrapper type (default tf::DefaultClosureWrapper) The partitioner divides iterations into chunks and distributes chunks to workers in order. If the chunk size is not specified (default 0), the partitioner resorts to a chunk size that equally distributes iterations into workers. std::vector<int>data={1,2,3,4,5,6,7,8,9,10} taskflow.for_each( data.begin(),data.end(),[](inti){},StaticPartitioner(0) ); executor.run(taskflow).run(); In addition to partition size, the application can specify a closure wrapper for a static partitioner. A closure wrapper allows the application to wrapper a partitioned task (i.e., closure) with a custom function object that performs additional tasks. For example: std::atomic<int>count=0; tf::Taskflowtaskflow; taskflow.for_each_index(0,100,1, [](){ printf("%d\n",i); }, tf::StaticPartitioner(0,[](auto&&closure){ //dosomethingbeforeinvokingthepartitionedtask //... //invokethepartitionedtask closure(); //dosomethingelseafterinvokingthepartitionedtask //... } ); executor.run(taskflow).wait(); tf::StaticPartitioner_chunk_size tf::StaticPartitioner_closure_wrapper tf::StaticPartitioneradjusted_chunk_size tf::StaticPartitionerchunk_size tf::StaticPartitionerchunk_size tf::StaticPartitionerclosure_wrapper tf::StaticPartitionerclosure_wrapper tf::StaticPartitionerclosure_wrapper_type tf::StaticPartitionerloop tf::StaticPartitionerloop_until tf::StaticPartitionerPartitionerBase tf::StaticPartitionerPartitionerBase tf::StaticPartitionerPartitionerBase tf::StaticPartitionerStaticPartitioner tf::StaticPartitionerStaticPartitioner tf::StaticPartitionerStaticPartitioner tf::StaticPartitionertype