- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

# Algorithms

## Classes
class | tbb::blocked_range< Value >
| A range over which to iterate. More...
class | tbb::blocked_range2d< RowValue, ColValue >
| A 2-dimensional range that models the Range concept. More...
class | tbb::blocked_range3d< PageValue, RowValue, ColValue >
| A 3-dimensional range that models the Range concept. More...
struct | tbb::pre_scan_tag
| Used to indicate that the initial scan is being performed. More...
struct | tbb::final_scan_tag
| Used to indicate that the final scan is being performed. More...
class | tbb::parallel_while< Body >
| Parallel iteration over a stream, with optional addition of more work. More...
class | tbb::simple_partitioner
| A simple partitioner. More...
class | tbb::auto_partitioner
| An auto partitioner. More...
class | tbb::filter
| A stage in a pipeline. More...
class | tbb::thread_bound_filter
| A stage in a pipeline served by a user thread. More...
class | tbb::pipeline
| A processing pipeline that applies filters to items. More...
class | tbb::split
| Dummy type that distinguishes splitting constructor from copy constructor. More...
## parallel_do
See also requirements on parallel_do Body.
template<typename Iterator, typename Body>
void | tbb::parallel_do (Iterator first, Iterator last, const Body &body)
| Parallel iteration over a range, with optional addition of more work.
template<typename Iterator, typename Body>
void | tbb::parallel_do (Iterator first, Iterator last, const Body &body, task_group_context &context)
| Parallel iteration over a range, with optional addition of more work and user-supplied context.
## parallel_for
See also requirements on Range and parallel_for Body.
template<typename Range, typename Body>
void | tbb::parallel_for (const Range &range, const Body &body)
| Parallel iteration over range with default partitioner.
template<typename Range, typename Body>
void | tbb::parallel_for (const Range &range, const Body &body, const simple_partitioner &partitioner)
| Parallel iteration over range with simple partitioner.
template<typename Range, typename Body>
void | tbb::parallel_for (const Range &range, const Body &body, const auto_partitioner &partitioner)
| Parallel iteration over range with auto_partitioner.
template<typename Range, typename Body>
void | tbb::parallel_for (const Range &range, const Body &body, affinity_partitioner &partitioner)
| Parallel iteration over range with affinity_partitioner.
template<typename Range, typename Body>
void | tbb::parallel_for (const Range &range, const Body &body, const simple_partitioner &partitioner, task_group_context &context)
| Parallel iteration over range with simple partitioner and user-supplied context.
template<typename Range, typename Body>
void | tbb::parallel_for (const Range &range, const Body &body, const auto_partitioner &partitioner, task_group_context &context)
| Parallel iteration over range with auto_partitioner and user-supplied context.
template<typename Range, typename Body>
void | tbb::parallel_for (const Range &range, const Body &body, affinity_partitioner &partitioner, task_group_context &context)
| Parallel iteration over range with affinity_partitioner and user-supplied context.
## parallel_for_each
template<typename InputIterator, typename Function>
void | tbb::parallel_for_each (InputIterator first, InputIterator last, const Function &f, task_group_context &context)
| Calls function f for all items from [first, last) interval using user-supplied context.
template<typename InputIterator, typename Function>
void | tbb::parallel_for_each (InputIterator first, InputIterator last, const Function &f)
| Uses default context.
## parallel_invoke
template<typename F0, typename F1>
void | tbb::parallel_invoke (const F0 &f0, const F1 &f1, tbb::task_group_context &context)
| Executes a list of tasks in parallel and waits for all tasks to complete.
template<typename F0, typename F1, typename F2>
void | tbb::parallel_invoke (const F0 &f0, const F1 &f1, const F2 &f2, tbb::task_group_context &context)
template<typename F0, typename F1, typename F2, typename F3>
void | tbb::parallel_invoke (const F0 &f0, const F1 &f1, const F2 &f2, const F3 &f3, tbb::task_group_context &context)
template<typename F0, typename F1, typename F2, typename F3, typename F4>
void | tbb::parallel_invoke (const F0 &f0, const F1 &f1, const F2 &f2, const F3 &f3, const F4 &f4, tbb::task_group_context &context)
template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5>
void | tbb::parallel_invoke (const F0 &f0, const F1 &f1, const F2 &f2, const F3 &f3, const F4 &f4, const F5 &f5, tbb::task_group_context &context)
template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6>
void | tbb::parallel_invoke (const F0 &f0, const F1 &f1, const F2 &f2, const F3 &f3, const F4 &f4, const F5 &f5, const F6 &f6, tbb::task_group_context &context)
template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6, typename F7>
void | tbb::parallel_invoke (const F0 &f0, const F1 &f1, const F2 &f2, const F3 &f3, const F4 &f4, const F5 &f5, const F6 &f6, const F7 &f7, tbb::task_group_context &context)
template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6, typename F7, typename F8>
void | tbb::parallel_invoke (const F0 &f0, const F1 &f1, const F2 &f2, const F3 &f3, const F4 &f4, const F5 &f5, const F6 &f6, const F7 &f7, const F8 &f8, tbb::task_group_context &context)
template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6, typename F7, typename F8, typename F9>
void | tbb::parallel_invoke (const F0 &f0, const F1 &f1, const F2 &f2, const F3 &f3, const F4 &f4, const F5 &f5, const F6 &f6, const F7 &f7, const F8 &f8, const F9 &f9, tbb::task_group_context &context)
template<typename F0, typename F1>
void | tbb::parallel_invoke (const F0 &f0, const F1 &f1)
template<typename F0, typename F1, typename F2>
void | tbb::parallel_invoke (const F0 &f0, const F1 &f1, const F2 &f2)
template<typename F0, typename F1, typename F2, typename F3>
void | tbb::parallel_invoke (const F0 &f0, const F1 &f1, const F2 &f2, const F3 &f3)
template<typename F0, typename F1, typename F2, typename F3, typename F4>
void | tbb::parallel_invoke (const F0 &f0, const F1 &f1, const F2 &f2, const F3 &f3, const F4 &f4)
template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5>
void | tbb::parallel_invoke (const F0 &f0, const F1 &f1, const F2 &f2, const F3 &f3, const F4 &f4, const F5 &f5)
template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6>
void | tbb::parallel_invoke (const F0 &f0, const F1 &f1, const F2 &f2, const F3 &f3, const F4 &f4, const F5 &f5, const F6 &f6)
template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6, typename F7>
void | tbb::parallel_invoke (const F0 &f0, const F1 &f1, const F2 &f2, const F3 &f3, const F4 &f4, const F5 &f5, const F6 &f6, const F7 &f7)
template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6, typename F7, typename F8>
void | tbb::parallel_invoke (const F0 &f0, const F1 &f1, const F2 &f2, const F3 &f3, const F4 &f4, const F5 &f5, const F6 &f6, const F7 &f7, const F8 &f8)
template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6, typename F7, typename F8, typename F9>
void | tbb::parallel_invoke (const F0 &f0, const F1 &f1, const F2 &f2, const F3 &f3, const F4 &f4, const F5 &f5, const F6 &f6, const F7 &f7, const F8 &f8, const F9 &f9)
## parallel_reduce
See also requirements on Range and parallel_reduce Body.
template<typename Range, typename Body>
void | tbb::parallel_reduce (const Range &range, Body &body)
| Parallel iteration with reduction and default partitioner.
template<typename Range, typename Body>
void | tbb::parallel_reduce (const Range &range, Body &body, const simple_partitioner &partitioner)
| Parallel iteration with reduction and simple_partitioner.
template<typename Range, typename Body>
void | tbb::parallel_reduce (const Range &range, Body &body, const auto_partitioner &partitioner)
| Parallel iteration with reduction and auto_partitioner.
template<typename Range, typename Body>
void | tbb::parallel_reduce (const Range &range, Body &body, affinity_partitioner &partitioner)
| Parallel iteration with reduction and affinity_partitioner.
template<typename Range, typename Body>
void | tbb::parallel_reduce (const Range &range, Body &body, const simple_partitioner &partitioner, task_group_context &context)
| Parallel iteration with reduction, simple partitioner and user-supplied context.
template<typename Range, typename Body>
void | tbb::parallel_reduce (const Range &range, Body &body, const auto_partitioner &partitioner, task_group_context &context)
| Parallel iteration with reduction, auto_partitioner and user-supplied context.
template<typename Range, typename Body>
void | tbb::parallel_reduce (const Range &range, Body &body, affinity_partitioner &partitioner, task_group_context &context)
| Parallel iteration with reduction, affinity_partitioner and user-supplied context.
template<typename Range, typename Value, typename RealBody, typename Reduction>
Value | tbb::parallel_reduce (const Range &range, const Value &identity, const RealBody &real_body, const Reduction &reduction)
| Parallel iteration with reduction and default partitioner.
template<typename Range, typename Value, typename RealBody, typename Reduction>
Value | tbb::parallel_reduce (const Range &range, const Value &identity, const RealBody &real_body, const Reduction &reduction, const simple_partitioner &partitioner)
| Parallel iteration with reduction and simple_partitioner.
template<typename Range, typename Value, typename RealBody, typename Reduction>
Value | tbb::parallel_reduce (const Range &range, const Value &identity, const RealBody &real_body, const Reduction &reduction, const auto_partitioner &partitioner)
| Parallel iteration with reduction and auto_partitioner.
template<typename Range, typename Value, typename RealBody, typename Reduction>
Value | tbb::parallel_reduce (const Range &range, const Value &identity, const RealBody &real_body, const Reduction &reduction, affinity_partitioner &partitioner)
| Parallel iteration with reduction and affinity_partitioner.
template<typename Range, typename Value, typename RealBody, typename Reduction>
Value | tbb::parallel_reduce (const Range &range, const Value &identity, const RealBody &real_body, const Reduction &reduction, const simple_partitioner &partitioner, task_group_context &context)
| Parallel iteration with reduction, simple partitioner and user-supplied context.
template<typename Range, typename Value, typename RealBody, typename Reduction>
Value | tbb::parallel_reduce (const Range &range, const Value &identity, const RealBody &real_body, const Reduction &reduction, const auto_partitioner &partitioner, task_group_context &context)
| Parallel iteration with reduction, auto_partitioner and user-supplied context.
template<typename Range, typename Value, typename RealBody, typename Reduction>
Value | tbb::parallel_reduce (const Range &range, const Value &identity, const RealBody &real_body, const Reduction &reduction, affinity_partitioner &partitioner, task_group_context &context)
| Parallel iteration with reduction, affinity_partitioner and user-supplied context.
## parallel_scan
See also requirements on Range and parallel_scan Body.
template<typename Range, typename Body>
void | tbb::parallel_scan (const Range &range, Body &body)
| Parallel prefix with default partitioner.
template<typename Range, typename Body>
void | tbb::parallel_scan (const Range &range, Body &body, const simple_partitioner &partitioner)
| Parallel prefix with simple_partitioner.
template<typename Range, typename Body>
void | tbb::parallel_scan (const Range &range, Body &body, const auto_partitioner &partitioner)
| Parallel prefix with auto_partitioner.
## parallel_sort
See also requirements on iterators for parallel_sort.
template<typename RandomAccessIterator, typename Compare>
void | tbb::parallel_sort (RandomAccessIterator begin, RandomAccessIterator end, const Compare &comp)
| Sorts the data in [begin,end) using the given comparator.
template<typename RandomAccessIterator>
void | tbb::parallel_sort (RandomAccessIterator begin, RandomAccessIterator end)
| Sorts the data in [begin,end) with a default comparator `std::less<RandomAccessIterator>`.
template<typename T>
void | tbb::parallel_sort (T *begin, T *end)
| Sorts the data in the range ``[begin,end) with a default comparator `std::less<T>`.

## Function Documentation

template<typename RandomAccessIterator, typename Compare>

void tbb::parallel_sort | ( | RandomAccessIterator | begin,
|  | RandomAccessIterator | end,
|  | const Compare & | comp |
| ) |  |  |

Sorts the data in [begin,end) using the given comparator.

The compare function object is used for all comparisons between elements during sorting. The compare object must define a bool operator() function.

Copyright © 2005-2010 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.