Home | Libraries | People | FAQ | More |
The and-predicate generator is used to test, whether the embedded generator succeeds without generating any output. It succeeds if the embedded generator succeeds.
// forwards to <boost/spirit/home/karma/operator/and_predicate.hpp> #include <boost/spirit/include/karma_and_predicate.hpp>
Also, see Include Structure.
Semantics of an expression is defined only where it differs from, or
is not defined in UnaryGenerator
.
Expression |
Semantics |
---|---|
|
The generator |
The and generator is implemented by redirecting all output produced by its embedded generator into a discarding device.
See Compound Attribute Notation.
Expression |
Attribute |
---|---|
|
|
Note | |
---|---|
The attribute of the and-predicate is not always |
The overall complexity of the and-predicate generator is defined by the complexity of its embedded generator. The complexity of the and-predicate generator itself is O(1).
Note | |
---|---|
The test harness for the example(s) below is presented in the Basics Examples section. |
Some includes:
#include <boost/spirit/include/karma.hpp> #include <boost/spirit/include/support_utree.hpp> #include <boost/spirit/include/phoenix_core.hpp> #include <boost/spirit/include/phoenix_operator.hpp> #include <boost/fusion/include/std_pair.hpp> #include <iostream> #include <string>
Some using declarations:
using boost::spirit::karma::double_; using boost::spirit::karma::ascii::char_; using boost::spirit::karma::ascii::string; using boost::phoenix::ref;
Basic usage of an and predicate generator:
test_generator_attr("b", &char_('a') << 'b' | 'c', 'a'); test_generator_attr("c", &char_('a') << 'b' | 'c', 'x'); test_generator_attr("abc", &string("123") << "abc" | "def", "123"); test_generator_attr("def", &string("123") << "abc" | "def", "456");