Boost logo

Boost Users :

Subject: Re: [Boost-users] proto: BOOST_PROTO_AUTO
From: Eric Niebler (eric_at_[hidden])
Date: 2009-01-05 19:44:23


Kim Kuen Tang wrote:
> Hi all,
>
> i have a question and a problem.
>
> The problem is that i would like to write code like:
> domain=Domain([0,1]*[0,1]);
> where Domain([0,1]*[0,1]) is an expression created with proto.
>
> But of course this line of code is illegal, because i have to provide
> the type of this expression Domain([0,1]*[0,1]).

That line of code is illegal because there is no way to make
"Domain([0,1]*[0,1])" a valid C++ expression. You need to work on your
syntax a little.

> So i have to write something like this:
> Domain([0,1]*[0,1])::type domain=Domain([0,1]*[0,1]);
> Is this correct?
>
> Now the question:
> To avoid code like above is this what the macro BOOST_PROTO_AUTO is for?
> Can i write
> BOOST_PROTO_AUTO( domain,Domain([0,1]*[0,1]) ); .

Yes, that is what BOOST_PROTO_AUTO is for.

-- 
Eric Niebler
BoostPro Computing
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