----- Original Message ----- 
From: "Joel de Guzman" <[EMAIL PROTECTED]>


> ----- Original Message ----- 
> From: "Peter Dimov" <[EMAIL PROTECTED]>
> 
> 
> > From: "Joel de Guzman" <[EMAIL PROTECTED]>
> > [...]
> > > The condition is expected to be a functor that returns
> > > a boolean condition. I was hoping that I can use the
> > > ref(b) as a functor such that I can write:
> > >
> > >     bool b;
> > >
> > >     if_p(ref(b))
> > >     [
> > >         parse_this
> > >     ]
> > 
> > Not a good idea. In lambda terms the above is var(b), not ref(b). We've been
> > using ref(x) to mean "just like x", i.e. ref(b)() means b(). One day we
> > might even get that core change that would enable
> > reference_wrapper<T>::operator T& to be considered in a ref(f)() expression;
> > for now, we "fake" it in bind, function, etc.
> 
> I beg to disagree. I do not see that as reasonable. The use of var(b) 
> will bring in tons of scaffolding. This is the main reason why I want to
> request for the operator(). I've struggled hard to keep the core
> of Spirit small enough to do micro parsing. I do not wish to force the
> user to use lambda or phoenix, bind nor function just to do such a trivial 
> operation that can be accomplished by a one-liner in ref(x).
> 
> Historically, Spirit had a ref(x) that does that identity thingy. It has been
> made obsolete in favor of boost::ref. I might have to bring it back to
> life if my request cannot be granted. I see no other way to accomplish
> ref(x)() for micro-parsing tasks.

On second thought, I see you have a point. If f is a functor, you'd want
ref(x)() to dispatch to x's operator(). Of course that does not work
now.

Hmmm....

Joel de Guzman
[EMAIL PROTECTED]
http://www.boost-consulting.com


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to