Commands and the STL
Consider the following classic (so classic I'm presenting it in C++03 terms) execution model: std::map<int, IFunctor*> CommandMap; Where the IFunctor interface has a virtual method virtual void process(const Message& inMessage) = 0; That's basically the substructure of a command pattern, if we assume that the Message class has int getMessageType() const; as a function. There's a potential problem. What if your data to be processed has to be analyzed not by some nice comparable key, but by a complex of conditions, where the characteristics looked at are variable, although either the conditions are exclusive - no two can be true if the same message - or they can be strictly ranked. Thus, say, the message is analyzed based on the client associated with it or the money associated with it, or the jurisdiction it is from, or a combination of the three. (E.g. the first priority condition might be "Client is a PEP", then, "Transaction is for over 100,000 an...