another candidate is the almost-never overloaded comma operator.
OK, OK, I know you guys are just having fun, but I'm about to get an aneurysm.
another candidate is the almost-never overloaded comma operator.
algorithm(container, /*stuff*/, &element::method)
and have things work, consistently and predictably, for _every_ algorithm and not just for_each.
I would be tempted to use << as a stream operator:
Notifier(listenerList) << somedata << moredata;
The side effects and behaviour of these operators are better documented and the syntax makes sense as it is similar to iostream, just my 2 cents worth...
Notifier would be a simple class like:
typedef vector<Interested*> Notifiable;
class Notifier
{
Notifiable * n;
public:
Notifier (Notifiable *n): n(n) { }
operator<<(...) { /* overloaded code here to send data to Notifiable */ }
};
Hang on, why do we need this to be a one-liner, anyway?
Because abstractions are cool :D
Nah, personal preference, I prefer common actions like sending a message to an observer to be as simple as possible to do, so long as the implementation is abstracted away nicely and we'll documented it's all good...