The template handles_container
is a template meta-function used as an attribute customization point. It
is invoked by the QiSequence
(>>) and KarmaSequence (<<) operators in order to determine
whether a sequence element (component) handles container attributes directly.
This customization point is invoked for container attributes only, and
only if the sequence is compatible with the supplied container attribute.

If a component, which is part of a sequence is able to handle a container
attribute directly, the sequence passes the attribute to the component
without any additional action. In Spirit.Qi the component
uses the attribute to directly store all matched attributes. In Spirit.Karma
the generator component extracts the attributes needed for output generation
directly from this attribute.

If a component, which is part of a sequence is not able to handle container
attributes, in Spirit.Qi the sequence passes a new
instance of the container attributes' value_type
to the parser component, inserting the result into the attribute on behalf
of the parser component. In Spirit.Karma the sequence
extracts the next container element on behalf of the generator component
and passing it the extracted value.

Result of the metafunction that evaluates to mpl::true_
if a given component type Component,
handles container attributes directly, mpl::false_
otherwise. Generally, any implementation of handles_container
needs to behave as if if was a MPL
Boolean Constant.

Spirit predefines specializations
of this customization point for several types. The following table lists
those types together with the conditions for which the corresponding specializations
will evaluate to mpl::true_ (see MPL
Boolean Constant):

Template Parameters

Semantics

Component, Attribute

Always returns mpl::false_
(the default).

rule<Iterator,T1,T2,T3,T4>,
Attribute

Returns is_container<A>, where A
is the attribute exposed by the rule (Spirit.Qi
and Spirit.Karma).

grammar<Iterator,T1,T2,T3,T4>,
Attribute

Returns is_container<A>, where A
is the attribute exposed by the grammar (Spirit.Qi
and Spirit.Karma).

The customization point handles_container
needs to be implemented for a specific type whenever this type directly
handles container attributes. It is applicable for parsers (Spirit.Qi)
and generators (Spirit.Karma). It will have to be
implemented under rare circumstances only.