Boost logo

Boost Users :

Subject: Re: [Boost-users] [Proto] Functions returning an expression
From: Eric Niebler (eric_at_[hidden])
Date: 2008-11-14 14:11:44


Joel Falcou wrote:
> I have a DSL defined in proto.
> What's the best wayt o build functions that returns an expression made
> of this DSl elements.
> Like let's say the vec_expr class support+-*/ operators
>
> I want to write
>
> ??? f( vec_expr<W> const& a, vec_expr<Y> const& b)
> {
> return (a+b)/(a-b);
> }
>
> How can I easily (aka no nested make_expr call) build the return type ?

Why don't you want to use make_expr? That's what it's for. You build the
return type with proto::result_of::make_expr, and call
proto::make_expr() from with f().

http://tinyurl.com/5nhmgw

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net