
On 9/30/07, Dean Michael Berris <mikhailberis@gmail.com> wrote:
Also Dispatcher::operator=() should be 'stacked' in some way though...but how?
Remember that operator=() can be implemented as part of the class -- and it can be overloaded much like the other operators. That means:
I see.
Perhaps if the key of the map is the function signature could be possible first find a match with the supplied arguments and then call the operator(), should be safe in that case. A (big) downside is that you forget implicit conversions this way.
This is one problem with the Fusion map approach, but something I perceive as really a non-issue -- because after all, the goal of the library is to provide a type-safe way of implementing a dispatcher.
On the other way a dispatcher as long as feeds arguments to a wrapped-in function is natural IMHO asking to act as transparent as possible between the argument values and the target function, i.e. should be a perfect forwarder once target function has been selected among the stored set. Under this view if a function void foo(std::string v); can be invoked with foo("test"); so should (IMHO) accept the foo wrapper and, at the end, the dispatcher that stores the wrapper. Just a questionable opinion ;-) Marco