Boost logo

Boost Users :

Subject: [Boost-users] calc2_ast.cpp
From: Olivier Austina (olivier.austina_at_[hidden])
Date: 2013-10-02 13:13:05


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.
Where can I find the definition of expr()?
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;
    };

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