Boost logo

Boost Users :

Subject: Re: [Boost-users] [Proto] POD expression can't be used in std::vector
From: Eric Niebler (eric_at_[hidden])
Date: 2008-11-22 16:41:03


Joel Falcou wrote:
> Joel Falcou a écrit :
>> I have a expression who use BOOST_PROTO_EXTEND to be used as a POD type
>> and I have a class inheriting from this expression to build a terminal
>> class.
>>
>> ...
>> Is it a proto bug or a std bug ?
>>
> OK seems I found the error myself. I was using
>
> bp::nary_expr< bp::_, bp::vararg<my_grammar> >
>
> as a rule in my_grammar, which obviously caught tag::address_of.
>
> Is it correct for matching any nary_expr *except* address_of :
> bp::nary_expr< bp::not_<pt::address_of>, bp::vararg<my_grammar> >
>
> or is there a better way if I want to prevent a subset of tag to be used ?

Right, as you've discovered, Proto overloads unary operator& by default,
but you can turn it off in your domain's grammar. The grammar you
suggested won't do it, though. Try this:

proto::and_<
     proto::nary_expr<_, proto::vararg<my_grammar> >
   , proto::not_< proto::address_of<_> >
>

HTH,

-- 
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