...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 end_container
is a type used as an attribute customization point. It is invoked by
the Karma repetitive generators (such as List
(%
), Kleene
(unary *
), Plus (unary +
), and Repeat)
in order to get an iterator pointing to the end of the container holding
the attributes to generate output from.
#include <boost/spirit/home/support/container.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 Container, typename Enable> struct end_container { static typename container_iterator<Container>::type call(Container& c); };
Parameter |
Description |
Default |
---|---|---|
|
The type, |
none |
|
Helper template parameter usable to selectively enable or disable
certain specializations of |
|
Notation
C
A container type the end iterator needs to be returned for.
c
An instance of a container, C
.
Expression |
Semantics |
---|---|
|
Return the iterator usable to compare a different iterator
with in order to detect whether the other iterator reached
the end of the given container, |
Spirit predefines specializations
of this customization point for several types. The following table lists
those types together with the types returned by the embedded typedef
type
:
Template Parameters |
Semantics |
---|---|
|
Returns |
|
Returns |
|
Returns |
The customization point end_container
needs to be implemented for a specific type whenever this type is to
be used as an attribute in place of a STL container. It is applicable
for generators (Spirit.Karma) only. As a rule of
thumb: it has to be implemented whenever a certain type is to be passed
as an attribute to a generator normally exposing a STL container, C
and if the type does not expose the
interface of a STL container (i.e. is_container<C>::type
would normally return mpl::false_
).
If this customization point is implemented, the following other customization points might need to be implemented as well.
Name |
When to implement |
---|---|
Needs to be implemented whenever a type is to be used as a container attribute in Karma. |
|
Karma: List
( |
|
Karma: List
( |
|
Karma: List
( |
|
Karma: List
( |
|
Karma: List
( |
|
Karma: List
( |
For examples of how to use the customization point end_container
please see here: embedded_container_example,
use_as_container,
and counter_example.