I'm just getting started with TBB, and am having problems trying to model something in this framework. Suppose I have an input sequence of data items consisting of a mixture of fruit, e.g. apples, pears and oranges. The processing I need to do on each of these fruit depends on the kind of fruit. Furthermore, I'd like to batch up the fruit into "boxes", each containing just one kind of fruit, so that I only process a box at a time. Without TBB I'd write a thread that read in the fruit one at a time, sorted them into buckets based on their type, and parceled them up into boxes. I'd then write separate threads for each fruit type, and use a producer/consumer model to pass boxes of apples to the apple thread, and similarly for all the other fruit. If these threads produced any results, e.g. how much we sold each box for, then I'd merge these results back into a stream for subsequent processing. Now my first thoughts were to model all this using TBB pipelines. But I couldn't see anything equivalent to a user-controlled multiway branch feeding separate pipeline stages, and a merge back from these independent stages to a single stream. Is there some more elegant way of modelling this in TBB, or some feature of the framework I'm overlooking?