...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Before generating output for a value this value needs to extracted from
the attribute instance provided by the user. The customization point extract_from
is utilized to adapt this
extraction for any data type possibly used to store the values to output.
#include <boost/spirit/home/karma/detail/extract_from.hpp>
Also, see Include Structure.
![]() |
Note |
---|---|
This header file does not need to be included directly by any user program as it is normally included by other Spirit header files relying on its content. |
Name |
---|
|
template <typename Attrib, typename Enable> struct extract_from_attribute { typedef <unspecified> type; template <typename Context> static type call(Attrib const& attr, Context& context); };
Parameter |
Description |
Default |
---|---|---|
|
The type, |
none |
|
Helper template parameter usable to selectively enable or disable
certain specializations of |
|
|
This is the type of the current generator execution context. |
Notation
Attrib
A type to be used to generate output from.
attr
A attribute instance of type Attrib
.
Expression |
Semantics |
---|---|
extract_from_attribute<Attrib>::call(attr, ctx)
|
Extract the value to generate output from and return it to the caller. |
Spirit predefines specializations of this customization point for several types. The following table lists those types together with the types exposed and the corresponding semantics:
Template Parameters |
Value |
---|---|
|
The exposed typedef |
|
The exposed typedef |
|
The exposed typedef |
|
The exposed typedef |
The customization point extract_from_attribute
needs to be implemented for a specific type whenever the default implementation
as shown above is not applicable. Examples for this could be that the type
to be extracted is different from Attrib
and is not copy constructible.
TBD