...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
The directives delimit[]
, no_delimit[]
, and verbatim[]
can be used to control automatic delimiting.
The directives verbatim[]
and no_delimit[]
disable any automatic delimiting, while
the directive delimit[]
(re-)enables automatic delimiting.
For the verbatim[]
directive:
// forwards to <boost/spirit/home/karma/directive/verbatim.hpp> #include <boost/spirit/include/karma_verbatim.hpp>
For the no_delimit[]
directive:
// forwards to <boost/spirit/home/karma/directive/no_delimit.hpp> #include <boost/spirit/include/karma_no_delimit.hpp>
For the delimit[]
directive:
// forwards to <boost/spirit/home/karma/directive/delimit.hpp> #include <boost/spirit/include/karma_delimit.hpp>
Also, see Include Structure.
Name |
---|
|
|
|
Notation
a
A generator object
d
A generator object, or a Lazy Argument that evaluates to a generator object
A
, D
Attribute types of the generators a
and d
Semantics of an expression is defined only where it differs from, or
is not defined in UnaryGenerator
.
Expression |
Semantics |
---|---|
|
Enable automatic delimiting for the embedded generator |
|
Enable automatic delimiting for the embedded generator |
|
Disable automatic delimiting for the embedded generator |
|
Disable automatic delimiting for the embedded generator |
See Compound Attribute Notation.
Expression |
Attribute |
---|---|
|
a: A --> delimit[a]: A a: Unused --> delimit[a]: Unused
|
|
a: A, d: D --> delimit(d)[a]: A a: Unused, d: D --> delimit(d)[a]: Unused
|
|
a: A --> verbatim[a]: A a: Unused --> verbatim[a]: Unused
|
|
a: A --> no_delimit[a]: A a: Unused --> no_delimit[a]: Unused
|
The overall complexity of the generator directives
delimit[]
,verbatim[]
, andno_delimit[]
is defined by the complexity of its embedded generators. The complexity of the directives themselves 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 <iostream> #include <string>
Some using declarations:
using boost::spirit::karma::double_; using boost::spirit::karma::delimit; using boost::spirit::karma::verbatim;
Basic usage of delimit
generator directive:
test_generator_attr("[ 2.0 , 4.3 ] ", delimit['[' << double_ << ',' << double_ << ']'], 2.0, 4.3); test_generator_attr("[*2.0*,*4.3*]*", delimit('*')['[' << double_ << ',' << double_ << ']'], 2.0, 4.3); test_generator_attr("[2.0, 4.3 ] ", delimit[verbatim['[' << double_ << ','] << double_ << ']'], 2.0, 4.3);