R -> A -> C -> D -> B -> E -> DEach capital letter represents an object of a class that inherits from Task. The user would specify the tree by typing something like this (if the tree above is confusing this might be clearer, I tried to make a clearer ASCII tree but the forum gobbles it): C.depends(A); D.depends(A); D.depends(B); E.depends(B); A.depends®; B.depends®; The tree represents control flow. When the tree is told to Start(), then R->Run() will be called and so some computation. When the computation is finished, R will have created some data. This data will be input for the A and B tasks, and A and B will be started in parallel (they each have their own thread). Then when A finishes it will give the data it computed to C and C will run. When B finishes it will gives its data to E and E will run. Notice that D is a child of both A and B. When both A and B are finished their combined data will be given to D and D will run. The general idea is that when all of the parents Tasks of a Task have been completed, that Task runs (its 'dependencies' are satisfied). The question is: How the heck do I implement this tree? Just getting the Run() functions to run multithreaded and in the proper order I don't think is too tough. The problem is how Tasks should pass data to each other (what actually happens when I wrote 'give the data' above). Ideally, the user should be able to specify that a Task produces a value of any arbitrary type, so long as child tasks are written to take an input of that type. My first thought was to make Task a templated class, with an input type parameter and an output type parameter. But looking at the example tree, D has _two_ inputs. The goal here is to avoid shared mutable data across threads (which leads to bugs). With this tree, if A is already done and B finishes, D and E will start simultaneously. Since A and B are known to have finished, so the data they computed is 'done cooking,' so there's no worrying about D or E reading garbage. And if D and E are only given _const references_ to the the result of B's computation, then they can't step on each other's toes either, and the compiler could check for this. But I just can't think of how to represent this tree in C++. If every task only had one input, things would be simpler, but Tasks like D exist in my application. I've thought about preprocessor and template magic, but the inspiration isn't coming. I think Boost's MPL could maybe help, but the online documentation is as opaque as steel. Any ideas?