...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
The template create_generator
is a type used as an customization point. It is invoked by the Karma
create_generator
API function
in order to create a custom mapping of the given data type to a generator
expression. This generator expression will be returned from create_generator
whenever the
given data type is encountered.
// forwards to <boost/spirit/home/karma/auto.hpp> #include <boost/spirit/include/karma_auto.hpp>
Also, see Include Structure.
Name |
---|
|
template <typename T, typename Enable> struct create_generator { typedef <unspecified> type; static type const& call(); };
Parameter |
Description |
Default |
---|---|---|
|
The type, |
none |
|
Helper template parameter usable to selectively enable or disable
certain specializations of |
|
Notation
T
An arbitrary type.
Expression |
Semantics |
---|---|
|
Defines the type of the generator expression returned from
|
|
Returns a generator expression (usually this is a proto::expression)
to be used as the default generator for the given type, |
Spirit predefines specializations of this customization point for several types. All predefined mappings are listed here: Additional Attribute Requirements for Generators.
Note | |
---|---|
It is possible to overload the predefined mappings for the listed types
by providing your own specialization of the |
The customization point create_generator
needs to be implemented for a specific type whenever this type should
be usable with the API function create_generator
(which includes
using the karma::auto_
generator and the special API
functions based on the automatic creation of the matching generator type).
For an example of how to use the customization point create_generator
please see here: Example
for Using the karma::auto_
Generator.