Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2008-03-06 17:53:18


Eric Niebler wrote:
> Phil Endecott wrote:
>> if I wanted to make the 10+20 subexpression a proto
>> expression, I'd need to somehow taint or cast 10. How would I do
>> that?
>
> proto::as_expr() is useful for this. Guess I should say that in the
> docs, somewhere.

I neglected to mention that if you're building a DSEL and you wish
"as_expr" were called something else, you can do this:

     proto::functional::as_expr<> const constant = {};

     int main()
     {
         constant(10) + 20;
         return 0;
     }

All of Proto's free functions have function object equivalents in the
proto::functional namespace.

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

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