Boost logo

Boost :

From: Daniel Walker (daniel.j.walker_at_[hidden])
Date: 2008-04-21 18:18:13


On Tue, Apr 15, 2008 at 1:35 AM, shunsuke <pstade.mb_at_[hidden]> wrote:
> Daniel Walker wrote:
<snip>
> > struct my_plus
> > {
> > template<class> struct result;
> > template<class Me, class X, class Y>
> > struct result<Me(X,Y)>
> > : boost::remove_cv<X>
> > { };
> >
> > template<class X, class Y>
> > typename result<my_plus(X,Y)>::type
> > operator()(X x, Y y) const
> > {
> > return x + y;
> > }
> > };
> >
> > To my eye, I can't see how Egg makes things that much easier. It
> > doesn't look particularly helpful.
>
> I was feeling annoyed that I had to write `typename result<my_plus(X,Y)>::type`.
> Also, your `result<>` implementation is wrong.
> It is error-prone to write ResultOf-conforming FunctionObject without some indirection.

How is this result<> implementation wrong? I'm not convinced that
writing result_of compatible functors is that error prone, but if I
made a mistake here, that would pretty much prove your point. ;-)

Also, I'm going to try to respond to your other comments as soon as I
can. I've been doing a little reading, and I have some suggestions for
refocusing/reframing a subset of the Egg problem domain in terms of
the standard library and Boost.Function. At least, I hope to come up
with some examples that are more concrete than I had in my original
comments.

Daniel


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