
Daniel Walker wrote:
On Wed, May 28, 2008 at 1:07 PM, Sohail Somani <sohail@taggedtype.net> wrote:
Hello,
Following up on several discussion over the last few weeks, I've placed an implementation of a polymorphic call wrapper (and associated utilities) similar to Boost.Function in the file polymorphic_function.zip in the Function Objects directory on vault at http://tinyurl.com/56zvo4. For those of us just joining, can you please give the main motivation for use of this new type? I hear polymorphic function and think many
Daniel Walker wrote: things, none of which may be close to the truth.
Thanks.
Sure. The short answer is that for an instance of boost::function, the return and argument types are fixed, whereas for an instance of polymorphic_function, they may vary. So, polymorphic_function allows you to deal with arbitrary callable object types without being forced to fix the return and argument types if one of those arbitrary callable objects happens to have a templated or overloaded operator().
Great explanation, thanks. So barring the do_division example, does it solve an existing problem? I'm not saying it isn't useful, I'm just trying to figure out if there is a problem I have currently that I could use to solve this or whether there are a greater class of problems we can now solve easily because this class exists. -- Sohail Somani http://uint32t.blogspot.com