Boost logo

Boost :

From: Sohail Somani (sohail_at_[hidden])
Date: 2008-05-28 18:51:57


Daniel Walker wrote:
> On Wed, May 28, 2008 at 1:07 PM, Sohail Somani <sohail_at_[hidden]> wrote:
>> Daniel Walker 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
>> 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

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk