The directives omit[]
and skip[]
consumes the attribute type of the embedded generator without generating
any output. The omit[] directive will still execute the embedded
generator while discarding the generated output afterwards. The skip[]
directive will not execute the embedded generator, but will use it only
to extract the exposed attribute type.

Basic usage of a omit
generator directive. It shows how it consumes the first element of the
provided attribute without generating anything, leaving the second element
of the attribute to the non-wrapped double_
generator.

Generally, this directive is helpful in situations, where the attribute
type contains more information (elements) than need to be used to generate
the required output. Normally in such situations we would resolve to
use semantic actions to explicitly pass the correct parts of the overall
attribute to the generators. The omit
directive helps achieving the same without having to use semantic actions.

Consider the attribute type:

typedeffusion::vector<int,double,std::string>attribute_type;

where we need to generate output only from the first and last element:

This is error prone and not really readable. The same can be achieved
by using the omit directive:

r=int_<<omit[double_]<<string;

which is at the same time more readable and more efficient as we don't
have to use semantic actions.

The semantics of using the skip[] directive are identical to the omit[]
directive, except that it does not actually execute the embedded generator.
For this reason it is usually preferable to utilize the skip[]
directive instead of the omit[] directive. On the other hand, the
omit[]
directive is very useful whenever the embedded generator produces side
effects (has semantic actions which need to be executed).