On Sat, 05 Sep 2015 12:21:33 +0200, Robert M. Münch wrote: > My "pieceOfWork" is not the same. So I don't have the case: Do 4 time > this 1thing. Instead, do 1 time these 4 things.
Ah, so you want to receive one each of various types? Something like this might work (untested): // These could be inferred using std.traits.ReturnType alias ResultTypes = AliasSeq!(int, float, Baz); bool received(T) = false; bool receivedAll() { foreach (T; ResultTypes) if (!received!T) return false; return true; } while (!receivedAll) { receive( (int x) { received!int = true; /* other work... */ }, (float x) { received!float = true; /* other work... */ }, (Baz x) { received!Baz = true; /* other work... */ } ); }