Question

I'm learning Boost-Spirit, from here and examples from StackOverflow.

However, I'm not able to find the difference between > and >> "followed by" sequence operator ?

For Instance , the difference here :-

        qi::phrase_parse(startIt
        , endIt
        , par_ob > ';' // par_ob >> ';' ??
        , qi::space
        , result
        );
Was it helpful?

Solution

Read the documentation and you will find:

Like the Sequence, the expectation operator, a > b, parses two or more operands (a, b, ... etc.), in sequence:

a > b > ...

However, while the plain Sequence simply returns a no-match (returns false) when one of the elements fail, the expectation: > operator throws an expectation_failure when the second or succeeding operands (all operands except the first) fail to match.

See:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top