Boost logo

Boost Users :

Subject: Re: [Boost-users] [Proto] Accessing inner types in transform
From: Eric Niebler (eric_at_[hidden])
Date: 2008-11-02 20:13:33


Joel Falcou wrote:
> So i may have missed something.
>
> Here is the transform :
>
> struct C_base
> : bp::or_< bp::when< bp::terminal<std::pair<arithmetic_grammar
> ,arithmetic_grammar>
> >
> , first_(bp::_)

You mean first_(bp::_value) here, right?

> >
> , bp::when< bp::terminal<i_value>, int()>
> , bp::when< arithmetic_grammar, bp::_value()>
> , bp::when< bp::unary_expr<bp::_,C_base>,C_base(bp::_child)>
> , bp::when< bp::binary_expr<bp::_
> ,arithmetic_grammar
> ,arithmetic_grammar
> >
> ,
> binary_result<arithmetic>(C_base(bp::_left),C_base(bp::_right) )
> >
> > {};
>
>
> here is first_
>
> struct first_ : bp::callable
> {
> template<class Sig> struct result;
> template<class This, class Pair>
> struct result<This(Pair)>
> {
> typedef typename boost::remove_reference<Pair>::type::first_type type;
> };

You'll need to define an operator() here, or else you'll get an error if
you actually use the transform for anything other than a type computation.

> };
>
>
> Now when I try to get the C_base of a terminal, i got :
> erreur: no type named «proto_base_expr» in «struct std::pair<float, float>
> and other similar error.
>
> What did I missed ?

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