Boost logo

Boost Users :

Subject: Re: [Boost-users] calc2_ast.cpp
From: Larry Evans (cppljevans_at_[hidden])
Date: 2013-10-02 13:24:24


On 10/02/13 12:13, Olivier Austina wrote:
> Hi,
> this is a basic question (I am sorry).
> I am try to undestand the calc2_ast.cpp example at
> http://www.boost.org/doc/libs/1_41_0/libs/spirit/example/qi/calc2_ast.cpp
> I think the instruction expression_ast() : expr(nil()){} is an
> inheritance.
expr is a member variable of expression_ast.
> Where can I find the definition of expr()?
See below.
> This is the code
> struct expression_ast
> {
> typedef
> boost::variant<
> nil // can't happen!
> , unsigned int
> , boost::recursive_wrapper<expression_ast>
> , boost::recursive_wrapper<binary_op>
> , boost::recursive_wrapper<unary_op>
> >
> type;
>
> *expression_ast() : expr(nil()){};*
>
> template <typename Expr>
> expression_ast(Expr const& expr)
> : expr(expr) {}
>
> expression_ast& operator+=(expression_ast const& rhs);
> expression_ast& operator-=(expression_ast const& rhs);
> expression_ast& operator*=(expression_ast const& rhs);
> expression_ast& operator/=(expression_ast const& rhs);
>
> type expr;
Here's the definition of expr.
> };
>
> //expression_ast bbb;
> struct binary_op
> {
> binary_op(
> char op
> , expression_ast const& left
> , expression_ast const& right)
> : op(op), left(left), right(right) {}
>
> char op;
> expression_ast left;
> expression_ast right;
> };
>
>
> Thank you.
>
>
>
> Regards
> Olivier
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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