![]() |
Home | Libraries | People | FAQ | More |
The columns[]
directive separates the output emitted by the embedded generator by inserting
special column separators.
// forwards to <boost/spirit/home/karma/directive/columns.hpp> #include <boost/spirit/include/karma_columns.hpp>
Also, see Include Structure.
|
Name |
|---|
|
|
Notation
aA generator object
gA generator object, or a Lazy Argument that evaluates to a generator object, will be used to emit column separators
A
Attribute type of generator a
[num
Numeric literal, any unsigned integer value, or a Lazy Argument that evaluates to an unsigned integer value defining the number of items to emit in between the column separators
Semantics of an expression is defined only where it differs from, or
is not defined in UnaryGenerator.
|
Expression |
Semantics |
|---|---|
|
|
The |
|
|
The |
|
|
The |
|
|
The |
See Compound Attribute Notation.
|
Expression |
Attribute |
|---|---|
|
|
a: A --> columns[a]: A a: Unused --> columns[a]: Unused
|
|
|
a: A --> columns(num)[a]: A a: Unused --> columns(num)[a]: Unused
|
|
|
a: A --> columns(g)[a]: A a: Unused --> columns(g)[a]: Unused
|
|
|
a: A --> columns(num, g)[a]: A a: Unused --> columns(num, g)[a]: Unused
|
The overall complexity of the
columnsgenerator directive depends on the complexity of the embedded generator. The complexity of thecolumnsgenerator directive itself is O(N), whereNis the number of inserted column separators.
![]() |
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/phoenix/core.hpp> #include <boost/phoenix/operator.hpp> #include <boost/fusion/include/std_pair.hpp> #include <boost/proto/deep_copy.hpp> #include <iostream> #include <string>
Some using declarations:
using boost::spirit::karma::double_; using boost::spirit::karma::columns; using boost::spirit::karma::space;
Basic usage of the columns
generators:
std::vector<double> v; v.push_back(1.0); v.push_back(2.0); v.push_back(3.0); test_generator_attr("1.0\n2.0\n3.0\n", columns(1)[*double_], v); test_generator_attr_delim("1.0 2.0 \n3.0 \n", columns(2)[*double_], space, v);