A type Body satisfies the ParallelForBody if it meet the Function Objects requirements from [function.objects] ISO C++ Standard section. Also it should meet one of the following requirements:

ParallelForEachBody Requirements: Pseudo-Signature, Semantics

Body::operator()(ItemType item) const

Process the received item.

Body::operator()(ItemType item, tbb::feeder<ItemType> &feeder) const

Process the received item. May invoke feeder.add(T) function to spawn the additional items.


ItemType may be optionally passed to Body::operator() by reference. const and volatile type qualifiers are also applicable.


The argument type ItemType should either satisfy the CopyConstructibe, MoveConstructibe or both requirements from ISO C++ [utility.arg.requirements] section. If the type is not CopyConstructibe, there are additional usage restrictions:

  • If Body::operator() accepts its argument by value, or if the InputIterator type from parallel_for_each algorithm does not also satisfy the Forward Iterator requirements from [forward.iterators] ISO C++ Standard section, then dereferencing an InputIterator must produce an rvalue reference.

  • Additional work items should be passed to the feeder as rvalues, for example via the std::move function.

See also: