Parser Directive Ignoring Attribute (omit[])

| Home | Libraries | People | FAQ | More

##### Parser Directive Ignoring Attribute (`omit[]`)

###### Description

The `omit[]` ignores the attribute of its subject parser replacing it with `unused`.

###### Header

    // forwards to <boost/spirit/home/qi/directive/omit.hpp>
    #include <boost/spirit/include/qi_omit.hpp>

Also, see Include Structure.

###### Namespace

Name
`boost::spirit::omit // alias: boost::spirit::qi::omit`

###### Model of

> `UnaryParser`

Notation

`a`

  A `Parser`.

###### Expression Semantics

Semantics of an expression is defined only where it differs from, or is not defined in `UnaryParser`.

Expression | Semantics
--- | ---
`omit[a]` | Ignore the attribute of the subject parser, `a`

###### Attributes

Expression | Attribute
--- | ---
`omit[a]` | `unused_type`

###### Complexity

> The complexity is defined by the complexity of the subject parser, `a`

###### Example

| Note
The test harness for the example(s) below is presented in the Basics Examples section.

Some using declarations:

    using boost::spirit::qi::omit;
    using boost::spirit::qi::int_;
    using boost::spirit::ascii::char_;

This parser ignores the first two characters and extracts the succeeding `int`:

    int i;
    test_parser_attr("xx345", omit[char_ >> char_] >> int_, i);
    std::cout << i << std::endl; // should print 345