|
Boost : |
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2002-04-17 16:26:18
"Douglas Gregor" <gregod_at_[hidden]> wrote in message
news:200204171837.g3HIbvM03473_at_mailout5.nyroc.rr.com...
> On Wednesday 17 April 2002 02:10 pm, you wrote:
> > > operator+ would be great, but it isn't feasible for arbitrary function
> > > objects.
> >
> > Why? What do you mean by "arbitrary function objects"? I was just
thinking
> > of overloading it for chaining two boost::function<>.
> >
> > Giovanni Bajo
>
> By "arbitrary function objects" I mean "any type that can be called like a
> function". It would be useful if we could have:
>
> void foo(Person&);
> void bar(Person);
>
> // ...
> std::list<Person> people;
> std::for_each(people.begin(), people.end(), foo+bar);
>
> That, of course, isn't going to happen because we can't just overload '+'
for
> every two types in the system :)
>
> And because we can't overload '+' for the general case, I think we
shouldn't
> overload '+' for just boost::function.
This does not sound like convincing argument. Why not allow such feature
only if one of the arguments is boost::function? Yet another reason to use
boost::function instead of plain pointers.
>
> Doug
>
Gennadiy.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk