From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-05-07 18:30:05


On Monday 07 May 2001 09:30 am, you wrote:
> ----- Original Message -----
> From: "Douglas Gregor" <gregod_at_[hidden]>
> To: <boost_at_[hidden]>
> Sent: Monday, May 07, 2001 1:16 AM
> Subject: Re: [boost] about function.hpp
>
> > I'm almost wondering if there really is a fundamental difference between
>
> the
>
> > two domains or if the lack of tools to enable the use of the "functor"
>
> domain
>
> > in C++ is the cause of the difference. If the binder and lambda libraries
> > were generally available and understood, would we be so reliant on the
> > standard callback types, to functions and member functions? I'll admit a
> > large degree of bias here because I tend to use the "functor" domain
> > quite often in my own code.
>
> Even if the library only supported pointers to free functions and bound
> pointers to member functions, it would be possible to use functors by
> passing a bound 'operator ()'. Of course this makes ownership issues a
> mess...
>
> There is the possibility of making all 'boost::function's that contain
> functors compare as unequal. There may also be the possibility of an
> alternate 'boost::function' constructor which enables 'operator ==' for
> functors (and requires that functors provide 'operator ==').

Yes, or even an external trait class that states whether or not a function
object is equality comparable. This would shift the burden to those using
operator== to specify that they indeed are using it. Still, even this is
unfortunate: if the user forgets to specialize the trait class, the function
objects will (silently!) fail to ever be compared.

        Doug