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