Intel® oneAPI Threading Building Blocks Developer Guide and API Reference
ID
772616
Date
4/28/2026
Public
Package Contents
Parallelizing Simple Loops
Parallelizing Complex Loops
Parallelizing Data Flow and Dependence Graphs
Work Isolation
Exceptions and Cancellation
Containers
Mutual Exclusion
Timing
Memory Allocation
The Task Scheduler
Design Patterns
Migrating from Threading Building Blocks (TBB)
Constrained APIs
Appendix A Costs of Time Slicing
Appendix B Mixing With Other Threading Packages
References
Feature-test Macros
TBB_malloc_replacement_log Function
Custom Assertion Handler
Type-specified message keys for join_node
Scalable Memory Pools
Helper Functions for Expressing Graphs
concurrent_lru_cache
task_group extensions
The customizing mutex type for concurrent_hash_map
Waiting for Single Messages in Flow Graph
parallel_phase Interface for Task Arena
Resource Limiting in the Flow Graph
Core Type Selector for Task Arena Constraints
Use of r-Values for Reduction
The functional form of parallel_reduce supports rvalue references in both the reduction function and the combine function. This allows efficient use of move operations when accumulated results are expensive to copy.
The example below merges a collection of std::set objects into a single set. Because the accumulator is passed as an rvalue reference, the algorithm can transfer nodes between sets without copying or moving the underlying data.
// C++17
#include <oneapi/tbb/parallel_reduce.h>
#include <oneapi/tbb/blocked_range.h>
#include <vector>
#include <set>
int main() {
std::vector<std::set<int>> sets;
oneapi::tbb::parallel_reduce(oneapi::tbb::blocked_range<size_t>(0, sets.size()),
std::set<int>{}, // identity element - empty set
[&](const oneapi::tbb::blocked_range<size_t>& range, std::set<int>&& value) {
for (size_t i = range.begin(); i < range.end(); ++i) {
// Having value as a non-const rvalue reference enables efficient
// transfer of nodes from sets[i] without copying or moving the elements
value.merge(std::move(sets[i]));
}
return value;
},
[&](std::set<int>&& x, std::set<int>&& y) {
x.merge(std::move(y));
return std::move(x);
}
);
}
See also