Opened 10 years ago

Closed 5 years ago

Last modified 5 years ago

#8187 closed Bugs (fixed)

Bug in phoenix docs and example code

Reported by: Eric Niebler Owned by: Kohei Takahashi
Milestone: Boost 1.67.0 Component: phoenix
Version: Boost 1.52.0 Severity: Cosmetic
Keywords: Cc:

Description

The example here is leading people astray. It is not recursively applying the transformation for node types other than plus, minus, multiplies and divides. If the top-most node is not one of those, no transformation happens.

The default case shown is:

struct invert_actions
{
    template <typename Rule>
    struct when
        : proto::_ // the default is proto::_
    {};
};

I think it should be:

struct invert_actions
{
    template <typename Rule>
    struct when
      : proto::nary_expr<
            proto::_,
            proto::vararg<
                proto::when<proto::_, evaluator(proto::_, _context)>
            >
        >
    {};
};

I'm actually not quite sure how this works, but it seems to. Note that the problem would also need to be fixed here.

See http://stackoverflow.com/questions/15077637/transforming-a-boost-c-phoenix-expression-tree for a discussion.

Change History (3)

comment:1 by Kohei Takahashi, 5 years ago

Milestone: To Be DeterminedBoost 1.65.0
Owner: changed from Thomas Heller to Kohei Takahashi

Yes, you are right.

comment:2 by Kohei Takahashi, 5 years ago

Resolution: fixed
Status: newclosed

comment:3 by Kohei Takahashi, 5 years ago

Milestone: Boost 1.65.0Boost 1.67.0
Note: See TracTickets for help on using tickets.