boost/doc/html/metaparse/reference.html
2021-10-05 21:37:46 +02:00

13861 lines
1.2 MiB
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Reference</title>
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../metaparse.html" title="Chapter 24. Boost.Metaparse">
<link rel="prev" href="the_design_of_the_library.html" title="The design of the library">
<link rel="next" href="../move.html" title="Chapter 25. Boost.Move">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
<td align="center"><a href="../../../index.html">Home</a></td>
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="the_design_of_the_library.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../metaparse.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../move.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="metaparse.reference"></a><a name="reference"></a><a class="link" href="reference.html" title="Reference">Reference</a>
</h2></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="reference.html#metaparse.reference.parsers_and_combinators_provided">Parsers
and combinators provided by the library</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.compile_time_data_structures_and">Compile-time
data structures and values</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.string">String</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.errors">Errors</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.tags">Tags</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.utilities">Utilities</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.terms_used_by_the_library">Terms
used by the library</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical">Alphabetical</a></span></dt>
</dl></div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="metaparse.reference.parsers_and_combinators_provided"></a><a class="link" href="reference.html#metaparse.reference.parsers_and_combinators_provided" title="Parsers and combinators provided by the library">Parsers
and combinators provided by the library</a>
</h3></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="reference.html#metaparse.reference.parsers_and_combinators_provided.parsers">Parsers</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.parsers_and_combinators_provided.combinators">Combinators</a></span></dt>
</dl></div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.parsers_and_combinators_provided.parsers"></a><a name="parsers"></a><a class="link" href="reference.html#metaparse.reference.parsers_and_combinators_provided.parsers" title="Parsers">Parsers</a>
</h4></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="reference.html#metaparse.reference.parsers_and_combinators_provided.parsers.character">Character</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.parsers_and_combinators_provided.parsers.numeric">Numeric</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.parsers_and_combinators_provided.parsers.whitespace">Whitespace</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.parsers_and_combinators_provided.parsers.validation_and_error_reporting">Validation
and error reporting</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.parsers_and_combinators_provided.parsers.miscellaneous">Miscellaneous</a></span></dt>
</dl></div>
<div class="section">
<div class="titlepage"><div><div><h5 class="title">
<a name="metaparse.reference.parsers_and_combinators_provided.parsers.character"></a><a class="link" href="reference.html#metaparse.reference.parsers_and_combinators_provided.parsers.character" title="Character">Character</a>
</h5></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a class="link" href="reference.html#alphanum">alphanum</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#digit">digit</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#letter">letter</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#lit">lit</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#lit_c">lit_c</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#one_char">one_char</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#one_char_except">one_char_except</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#one_char_except_c">one_char_except_c</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#range">range</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#range_c">range_c</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#space">space</a>
</li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h5 class="title">
<a name="metaparse.reference.parsers_and_combinators_provided.parsers.numeric"></a><a class="link" href="reference.html#metaparse.reference.parsers_and_combinators_provided.parsers.numeric" title="Numeric">Numeric</a>
</h5></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a class="link" href="reference.html#digit_val">digit_val</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#int_">int_</a>
</li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h5 class="title">
<a name="metaparse.reference.parsers_and_combinators_provided.parsers.whitespace"></a><a class="link" href="reference.html#metaparse.reference.parsers_and_combinators_provided.parsers.whitespace" title="Whitespace">Whitespace</a>
</h5></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a class="link" href="reference.html#space">space</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#spaces">spaces</a>
</li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h5 class="title">
<a name="metaparse.reference.parsers_and_combinators_provided.parsers.validation_and_error_reporting"></a><a class="link" href="reference.html#metaparse.reference.parsers_and_combinators_provided.parsers.validation_and_error_reporting" title="Validation and error reporting">Validation
and error reporting</a>
</h5></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a class="link" href="reference.html#empty">empty</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#fail">fail</a>
</li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h5 class="title">
<a name="metaparse.reference.parsers_and_combinators_provided.parsers.miscellaneous"></a><a class="link" href="reference.html#metaparse.reference.parsers_and_combinators_provided.parsers.miscellaneous" title="Miscellaneous">Miscellaneous</a>
</h5></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a class="link" href="reference.html#keyword">keyword</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#return_">return_</a>
</li>
</ul></div>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.parsers_and_combinators_provided.combinators"></a><a name="combinators"></a><a class="link" href="reference.html#metaparse.reference.parsers_and_combinators_provided.combinators" title="Combinators">Combinators</a>
</h4></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="reference.html#metaparse.reference.parsers_and_combinators_provided.combinators.validation_and_error_reporting">Validation
and error reporting</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.parsers_and_combinators_provided.combinators.repetition">Repetition</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.parsers_and_combinators_provided.combinators.selection">Selection</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.parsers_and_combinators_provided.combinators.sequence">Sequence</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.parsers_and_combinators_provided.combinators.result_transformation_semantic_a">Result
transformation (semantic actions)</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.parsers_and_combinators_provided.combinators.miscellaneous">Miscellaneous</a></span></dt>
</dl></div>
<div class="section">
<div class="titlepage"><div><div><h5 class="title">
<a name="metaparse.reference.parsers_and_combinators_provided.combinators.validation_and_error_reporting"></a><a class="link" href="reference.html#metaparse.reference.parsers_and_combinators_provided.combinators.validation_and_error_reporting" title="Validation and error reporting">Validation
and error reporting</a>
</h5></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a class="link" href="reference.html#accept_when">accept_when</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#change_error_message">change_error_message</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#entire_input">entire_input</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#except">except</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#fail_at_first_char_expected">fail_at_first_char_expected</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#transform_error">transform_error</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#transform_error_message">transform_error_message</a>
</li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h5 class="title">
<a name="metaparse.reference.parsers_and_combinators_provided.combinators.repetition"></a><a class="link" href="reference.html#metaparse.reference.parsers_and_combinators_provided.combinators.repetition" title="Repetition">Repetition</a>
</h5></div></div></div>
<p>
See the <a class="link" href="user_manual.html#repetition">Repetition</a> section of the
<a class="link" href="user_manual.html#manual">User Manual</a> for a detailed comparison of
the most common repetition combinators.
</p>
<p>
<a class="link" href="user_manual.html#finding-the-right-folding-parser-combinator">Cheat-sheet</a>
for choosing among the <code class="computeroutput"><span class="identifier">fold</span><span class="special">*</span></code> parsers.
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a class="link" href="reference.html#foldl">foldl</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#foldl1">foldl1</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#foldl_reject_incomplete">foldl_reject_incomplete</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#foldl_reject_incomplete1">foldl_reject_incomplete1</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#foldl_reject_incomplete_start_with_parser">foldl_reject_incomplete_start_with_parser</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#foldl_start_with_parser">foldl_start_with_parser</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#foldr">foldr</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#foldr1">foldr1</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#foldr_reject_incomplete">foldr_reject_incomplete</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#foldr_reject_incomplete1">foldr_reject_incomplete1</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#foldr_start_with_parser">foldr_start_with_parser</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#iterate">iterate</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#iterate_c">iterate_c</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#repeated">repeated</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#repeated1">repeated1</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#repeated_reject_incomplete">repeated_reject_incomplete</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#repeated_reject_incomplete1">repeated_reject_incomplete1</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#repeated_one_of">repeated_one_of</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#repeated_one_of1">repeated_one_of1</a>
</li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h5 class="title">
<a name="metaparse.reference.parsers_and_combinators_provided.combinators.selection"></a><a class="link" href="reference.html#metaparse.reference.parsers_and_combinators_provided.combinators.selection" title="Selection">Selection</a>
</h5></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a class="link" href="reference.html#if_">if_</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#one_of">one_of</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#one_of_c">one_of_c</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#optional">optional</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#repeated_one_of">repeated_one_of</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#repeated_one_of1">repeated_one_of1</a>
</li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h5 class="title">
<a name="metaparse.reference.parsers_and_combinators_provided.combinators.sequence"></a><a class="link" href="reference.html#metaparse.reference.parsers_and_combinators_provided.combinators.sequence" title="Sequence">Sequence</a>
</h5></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a class="link" href="reference.html#first_of">first_of</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#last_of">last_of</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#middle_of">middle_of</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#nth_of">nth_of</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#nth_of_c">nth_of_c</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#sequence">sequence</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#sequence_apply">sequence_apply</a>
</li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h5 class="title">
<a name="metaparse.reference.parsers_and_combinators_provided.combinators.result_transformation_semantic_a"></a><a class="link" href="reference.html#metaparse.reference.parsers_and_combinators_provided.combinators.result_transformation_semantic_a" title="Result transformation (semantic actions)">Result
transformation (semantic actions)</a>
</h5></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a class="link" href="reference.html#always">always</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#always_c">always_c</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#transform">transform</a>
</li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h5 class="title">
<a name="metaparse.reference.parsers_and_combinators_provided.combinators.miscellaneous"></a><a class="link" href="reference.html#metaparse.reference.parsers_and_combinators_provided.combinators.miscellaneous" title="Miscellaneous">Miscellaneous</a>
</h5></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a class="link" href="reference.html#grammar">grammar</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#look_ahead">look_ahead</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#token">token</a>
</li>
</ul></div>
</div>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="metaparse.reference.compile_time_data_structures_and"></a><a class="link" href="reference.html#metaparse.reference.compile_time_data_structures_and" title="Compile-time data structures and values">Compile-time
data structures and values</a>
</h3></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="reference.html#metaparse.reference.compile_time_data_structures_and.result_of_parsing">Result
of parsing</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.compile_time_data_structures_and.source_position">Source
position</a></span></dt>
</dl></div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.compile_time_data_structures_and.result_of_parsing"></a><a class="link" href="reference.html#metaparse.reference.compile_time_data_structures_and.result_of_parsing" title="Result of parsing">Result
of parsing</a>
</h4></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a class="link" href="reference.html#accept">accept</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#get_message">get_message</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#get_position">get_position</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#get_remaining">get_remaining</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#get_result">get_result</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#is_error">is_error</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#reject">reject</a>
</li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.compile_time_data_structures_and.source_position"></a><a class="link" href="reference.html#metaparse.reference.compile_time_data_structures_and.source_position" title="Source position">Source
position</a>
</h4></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a class="link" href="reference.html#get_col">get_col</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#get_line">get_line</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#get_prev_char">get_prev_char</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#next_char">next_char</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#next_line">next_line</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#source_position">source_position</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#source_position_tag">source_position_tag</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#start">start</a>
</li>
</ul></div>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="metaparse.reference.string"></a><a name="ref-string"></a><a class="link" href="reference.html#metaparse.reference.string" title="String">String</a>
</h3></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a class="link" href="reference.html#string">string</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#string_tag">string_tag</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#BOOST_METAPARSE_STRING">BOOST_METAPARSE_STRING</a>
</li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="metaparse.reference.errors"></a><a class="link" href="reference.html#metaparse.reference.errors" title="Errors">Errors</a>
</h3></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a class="link" href="reference.html#digit_expected">digit_expected</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#end_of_input_expected">end_of_input_expected</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#expected_to_fail">expected_to_fail</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#index_out_of_range">index_out_of_range</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#letter_expected">letter_expected</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#literal_expected">literal_expected</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#none_of_the_expected_cases_found">none_of_the_expected_cases_found</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#unexpected_character">unexpected_character</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#unexpected_end_of_input">unexpected_end_of_input</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#unpaired">unpaired</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#whitespace_expected">whitespace_expected</a>
</li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="metaparse.reference.tags"></a><a class="link" href="reference.html#metaparse.reference.tags" title="Tags">Tags</a>
</h3></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a class="link" href="reference.html#accept_tag">accept_tag</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#fail_tag">fail_tag</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#source_position_tag">source_position_tag</a>
</li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="metaparse.reference.utilities"></a><a class="link" href="reference.html#metaparse.reference.utilities" title="Utilities">Utilities</a>
</h3></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a class="link" href="reference.html#build_parser">build_parser</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#debug_parsing_error">debug_parsing_error</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#BOOST_METAPARSE_DEFINE_ERROR">BOOST_METAPARSE_DEFINE_ERROR</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#BOOST_METAPARSE_VERSION">BOOST_METAPARSE_VERSION</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#unless_error">unless_error</a>
</li>
</ul></div>
<p>
Metaparse uses a number of general purpose metafunctions and metafunction
classes.
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a class="link" href="reference.html#digit_to_int">digit_to_int</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#digit_to_int_c">digit_to_int_c</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#int_to_digit">int_to_digit</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#int_to_digit_c">int_to_digit_c</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#in_range">in_range</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#in_range_c">in_range_c</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#is_digit">is_digit</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#is_lcase_letter">is_lcase_letter</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#is_letter">is_letter</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#is_ucase_letter">is_ucase_letter</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#is_whitespace">is_whitespace</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#is_whitespace_c">is_whitespace_c</a>
</li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="metaparse.reference.terms_used_by_the_library"></a><a class="link" href="reference.html#metaparse.reference.terms_used_by_the_library" title="Terms used by the library">Terms
used by the library</a>
</h3></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a class="link" href="reference.html#boxed_value">boxed value</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#currying">currying</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#lazy_metafunction">lazy template metafunction</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#nullary_metafunction">nullary template metafunction</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#parser">parser</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#parser_combinator">parser combinator</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#parsing_error_message">parsing error message</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#predicate">predicate</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#tag">tag</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#metafunction">template metafunction</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#metafunction_class">template metafunction class</a>
</li>
<li class="listitem">
<a class="link" href="reference.html#metaprogramming_value">template metaprogramming value</a>
</li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="metaparse.reference.alphabetical"></a><a class="link" href="reference.html#metaparse.reference.alphabetical" title="Alphabetical">Alphabetical</a>
</h3></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.accept">accept</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.accept_tag">accept_tag</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.accept_when">accept_when</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.alphanum">alphanum</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.always_c">always_c</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.always">always</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.boost_metaparse_define_error">BOOST_METAPARSE_DEFINE_ERROR</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.boost_metaparse_string">BOOST_METAPARSE_STRING</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.boost_metaparse_version">BOOST_METAPARSE_VERSION</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.boxed_value">Boxed
value</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.build_parser">build_parser</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.change_error_message">change_error_message</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.currying">Currying</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.debug_parsing_error">debug_parsing_error</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.digit_expected">digit_expected</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.digit">digit</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.digit_to_int_c">digit_to_int_c</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.digit_to_int">digit_to_int</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.digit_val">digit_val</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.empty">empty</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.end_of_input_expected">end_of_input_expected</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.entire_input">entire_input</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.except">except</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.expected_to_fail">expected_to_fail</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.fail_at_first_char_expected">fail_at_first_char_expected</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.fail">fail</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.fail_tag">fail_tag</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.first_of">first_of</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.foldl1">foldl1</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.foldl_reject_incomplete">foldl_reject_incomplete</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.foldl_reject_incomplete1">foldl_reject_incomplete1</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.foldl_reject_incomplete_start_wi">foldl_reject_incomplete_start_with_parser</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.foldl_start_with_parser">foldl_start_with_parser</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.foldl">foldl</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.foldr1">foldr1</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.foldr_reject_incomplete">foldr_reject_incomplete</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.foldr_reject_incomplete1">foldr_reject_incomplete1</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.foldr_start_with_parser">foldr_start_with_parser</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.foldr">foldr</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.get_col">get_col</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.get_line">get_line</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.get_message">get_message</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.get_position">get_position</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.get_prev_char">get_prev_char</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.get_remaining">get_remaining</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.get_result">get_result</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.grammar">grammar</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.if">if_</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.index_out_of_range">index_out_of_range</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.in_range_c">in_range_c</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.in_range">in_range</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.int">int_</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.int_to_digit_c">int_to_digit_c</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.int_to_digit">int_to_digit</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.is_digit">is_digit</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.is_error">is_error</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.is_lcase_letter">is_lcase_letter</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.is_letter">is_letter</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.is_ucase_letter">is_ucase_letter</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.is_whitespace_c">is_whitespace_c</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.is_whitespace">is_whitespace</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.iterate_c">iterate_c</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.iterate">iterate</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.keyword">keyword</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.last_of">last_of</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.lazy_template_metafunction">Lazy
template metafunction</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.letter_expected">letter_expected</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.letter">letter</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.lit_c">lit_c</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.literal_expected">literal_expected</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.lit">lit</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.look_ahead">look_ahead</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.template_metafunction_class">Template
metafunction class</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.template_metafunction">Template
metafunction</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.template_metaprogramming_value">Template
metaprogramming value</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.middle_of">middle_of</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.next_char">next_char</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.next_line">next_line</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.none_of_the_expected_cases_found">none_of_the_expected_cases_found</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.nth_of_c">nth_of_c</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.nth_of">nth_of</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.nullary_template_metafunction">Nullary
template metafunction</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.one_char_except_c">one_char_except_c</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.one_char_except">one_char_except</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.one_char">one_char</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.one_of_c">one_of_c</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.one_of">one_of</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.optional">optional</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.parser_combinator">Parser
combinator</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.parser">Parser</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.parsing_error_message">Parsing
error message</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.predicate">Predicate</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.range_c">range_c</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.range">range</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.reject">reject</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.repeated1">repeated1</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.repeated_reject_incomplete1">repeated_reject_incomplete1</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.repeated_reject_incomplete">repeated_reject_incomplete</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.repeated_one_of1">repeated_one_of1</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.repeated_one_of">repeated_one_of</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.repeated">repeated</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.return">return_</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.sequence">sequence</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.sequence_apply">sequence_apply</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.source_position">source_position</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.source_position_tag">source_position_tag</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.space">space</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.spaces">spaces</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.start">start</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.string">string</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.string_tag">string_tag</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.tag">Tag</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.token">token</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.transform_error_message">transform_error_message</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.transform_error">transform_error</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.transform">transform</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.unexpected_character">unexpected_character</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.unexpected_end_of_input">unexpected_end_of_input</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.unless_error">unless_error</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.unpaired">unpaired</a></span></dt>
<dt><span class="section"><a href="reference.html#metaparse.reference.alphabetical.whitespace_expected">whitespace_expected</a></span></dt>
</dl></div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.accept"></a><a name="accept"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.accept" title="accept">accept</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.accept.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.accept.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.accept.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Result</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Remaining</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Pos</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">accept</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.accept.arguments"></a><p class="title"><b>Table 24.2. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Result</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Remaining</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#string">string</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Pos</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#source_position">source position</a>
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.accept.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.accept.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.accept.description">Description</a>
</h2>
<p>
Values representing a successful parser application. It behaves as a <a class="link" href="reference.html#lazy_metafunction">lazy template metafunction</a>: when it
is evaluated as a metafunction, it returns itself with its arguments evaluated.
See expression semantics for further details.
</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
Note that for backward compatibility when <code class="computeroutput"><span class="identifier">Result</span><span class="special">::</span><span class="identifier">type</span></code>
is not defined, <code class="computeroutput"><span class="identifier">accept</span><span class="special">&lt;....&gt;::</span><span class="identifier">type</span></code>
does not evaluate <code class="computeroutput"><span class="identifier">Result</span></code>.
For example <code class="computeroutput"><span class="identifier">accept</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"foo"</span><span class="special">),</span>
<span class="identifier">start</span><span class="special">&gt;::</span><span class="identifier">type</span></code> is <code class="computeroutput"><span class="identifier">accept</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"foo"</span><span class="special">)::</span><span class="identifier">type</span><span class="special">,</span> <span class="identifier">start</span><span class="special">::</span><span class="identifier">type</span><span class="special">&gt;</span></code>. Using types that are not template
metaprogramming values as <code class="computeroutput"><span class="identifier">Result</span></code>
is deprecated and will not work in future versions of the library.
</p></td></tr>
</table></div>
<h2>
<a name="metaparse.reference.alphabetical.accept.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.accept.expressions_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.accept.expressions_semantics">Expressions
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">r</span></code> template metaprogramming
value, <code class="computeroutput"><span class="identifier">s</span></code> compile-time string
and <code class="computeroutput"><span class="identifier">p</span></code> source position the
following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">accept</span><span class="special">&lt;</span><span class="identifier">r</span><span class="special">,</span> <span class="identifier">s</span><span class="special">,</span> <span class="identifier">p</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="identifier">accept</span><span class="special">&lt;</span><span class="identifier">r</span><span class="special">,</span> <span class="identifier">s</span><span class="special">::</span><span class="identifier">type</span><span class="special">,</span> <span class="identifier">p</span><span class="special">::</span><span class="identifier">type</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.accept.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.accept.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.accept.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">accept</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.accept.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.accept.operations"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.accept.operations">Operations</a>
</h2>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a class="link" href="reference.html#get_position"><code class="computeroutput"><span class="identifier">get_position</span></code></a>
</li>
<li class="listitem">
<a class="link" href="reference.html#get_remaining"><code class="computeroutput"><span class="identifier">get_remaining</span></code></a>
</li>
<li class="listitem">
<a class="link" href="reference.html#get_result"><code class="computeroutput"><span class="identifier">get_result</span></code></a>
</li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.accept_tag"></a><a name="accept_tag"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.accept_tag" title="accept_tag">accept_tag</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.accept_tag.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.accept_tag.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.accept_tag.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">accept_tag</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#tag">tag</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.accept_tag.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.accept_tag.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.accept_tag.description">Description</a>
</h2>
<p>
This is the tag of the values returned by a parser when parsing was successful.
</p>
<h2>
<a name="metaparse.reference.alphabetical.accept_tag.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.accept_tag.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.accept_tag.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">accept_tag</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.accept_when"></a><a name="accept_when"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.accept_when" title="accept_when">accept_when</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.accept_when.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.accept_when.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.accept_when.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Msg</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">accept_when</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.accept_when.arguments"></a><p class="title"><b>Table 24.3. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Pred</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#predicate">predicate</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Msg</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parsing_error_message">parsing error message</a>
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.accept_when.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.accept_when.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.accept_when.description">Description</a>
</h2>
<p>
It parses the input with <code class="computeroutput"><span class="identifier">P</span></code>.
When <code class="computeroutput"><span class="identifier">P</span></code> rejects the input,
<code class="computeroutput"><span class="identifier">accept_when</span></code> rejects it
as well. When <code class="computeroutput"><span class="identifier">P</span></code> accepts
it, <code class="computeroutput"><span class="identifier">accept_when</span></code> evaluates
<code class="computeroutput"><span class="identifier">Pred</span></code> with the result of
parsing the input with <code class="computeroutput"><span class="identifier">P</span></code>.
When <code class="computeroutput"><span class="identifier">Pred</span></code> returns <code class="computeroutput"><span class="keyword">true</span></code>, <code class="computeroutput"><span class="identifier">accept_when</span></code>
accepts the input and the result of parsing will be what <code class="computeroutput"><span class="identifier">P</span></code> returned. Otherwise <code class="computeroutput"><span class="identifier">accept_when</span></code>
rejects the input and <code class="computeroutput"><span class="identifier">Msg</span></code>
is used as the error reason.
</p>
<h2>
<a name="metaparse.reference.alphabetical.accept_when.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.accept_when.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.accept_when.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">accept_when</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.accept_when.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.accept_when.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.accept_when.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser, <code class="computeroutput"><span class="identifier">pred</span></code> predicate, <code class="computeroutput"><span class="identifier">msg</span></code>
parsing error message, <code class="computeroutput"><span class="identifier">s</span></code>
compile-time string and <code class="computeroutput"><span class="identifier">pos</span></code>
source position
</p>
<pre class="programlisting"><span class="identifier">accept_when</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">pred</span><span class="special">,</span> <span class="identifier">msg</span><span class="special">&gt;</span><span class="identifier">i</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;::</span><span class="identifier">type</span>
</pre>
<p>
is equivalent to
</p>
<pre class="programlisting"><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;::</span><span class="identifier">type</span>
</pre>
<p>
when <code class="computeroutput"><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span></code> doesn't return an error and <code class="computeroutput"><span class="identifier">pred</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;&gt;::</span><span class="identifier">type</span></code>
is <code class="computeroutput"><span class="keyword">true</span></code>. Otherwise it is equivalent
to
</p>
<pre class="programlisting"><span class="identifier">fail</span><span class="special">&lt;</span><span class="identifier">msg</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.accept_when.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.accept_when.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.accept_when.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">accept_when</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">one_char</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">is_digit</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">define_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="identifier">BOOST_METAPARSE_DEFINE_ERROR</span><span class="special">(</span><span class="identifier">digit_expected</span><span class="special">,</span> <span class="string">"Digit expected"</span><span class="special">);</span>
<span class="keyword">using</span> <span class="identifier">accept_digit</span> <span class="special">=</span> <span class="identifier">accept_when</span><span class="special">&lt;</span><span class="identifier">one_char</span><span class="special">,</span> <span class="identifier">util</span><span class="special">::</span><span class="identifier">is_digit</span><span class="special">&lt;&gt;,</span> <span class="identifier">digit_expected</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">accept_digit</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"0"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"accept_digit should accept a digit"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">accept_digit</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"0"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="char">'0'</span><span class="special">,</span>
<span class="string">"the result of parsing should be the character value"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">accept_digit</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"x"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"accept_digit should reject a character that is not a digit"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.alphanum"></a><a name="alphanum"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.alphanum" title="alphanum">alphanum</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.alphanum.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.alphanum.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.alphanum.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">alphanum</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser">parser</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.alphanum.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.alphanum.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.alphanum.description">Description</a>
</h2>
<p>
It accepts one character in the range <code class="computeroutput"><span class="identifier">a</span><span class="special">-</span><span class="identifier">z</span></code>,
<code class="computeroutput"><span class="identifier">A</span><span class="special">-</span><span class="identifier">Z</span></code> or <code class="computeroutput"><span class="number">0</span><span class="special">-</span><span class="number">9</span></code>. The result
of the parser is the accepted character.
</p>
<h2>
<a name="metaparse.reference.alphabetical.alphanum.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.alphanum.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.alphanum.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">alphanum</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.alphanum.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.alphanum.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.alphanum.expression_semantics">Expression
semantics</a>
</h2>
<p>
The following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">alphanum</span>
<span class="identifier">one_of</span><span class="special">&lt;</span><span class="identifier">digit</span><span class="special">,</span> <span class="identifier">letter</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.alphanum.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.alphanum.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.alphanum.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">alphanum</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">alphanum</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"0"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"alphanum should accept a digit"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">alphanum</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"x"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"alphanum should accept a character"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">alphanum</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"x"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="char">'x'</span><span class="special">,</span>
<span class="string">"the result of parsing should be the character value"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">alphanum</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">","</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"alphanum should reject a comma"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.always_c"></a><a name="always_c"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.always_c" title="always_c">always_c</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.always_c.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.always_c.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.always_c.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">char</span> <span class="identifier">C</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">always_c</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.always_c.arguments"></a><p class="title"><b>Table 24.4. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">C</span></code>
</p>
</td>
<td>
<p>
character
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">T</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a>
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.always_c.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.always_c.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.always_c.description">Description</a>
</h2>
<p>
It accepts inputs beginning with the <code class="computeroutput"><span class="identifier">C</span></code>
character. It consumes that character and the result of parsing is <code class="computeroutput"><span class="identifier">T</span></code>. Other inputs as rejected.
</p>
<h2>
<a name="metaparse.reference.alphabetical.always_c.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.always_c.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.always_c.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">always_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.always_c.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.always_c.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.always_c.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">c</span></code> character and
<code class="computeroutput"><span class="identifier">t</span></code> class the following are
equivalent:
</p>
<pre class="programlisting"><span class="identifier">always_c</span><span class="special">&lt;</span><span class="identifier">c</span><span class="special">,</span> <span class="identifier">t</span><span class="special">&gt;</span>
<span class="identifier">always</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="identifier">c</span><span class="special">&gt;,</span> <span class="identifier">t</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.always_c.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.always_c.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.always_c.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">always_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">always13</span> <span class="special">=</span> <span class="identifier">always_c</span><span class="special">&lt;</span><span class="char">'x'</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">always13</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"x"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"always13 should accept x"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
<span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">always13</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"x"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"the result of parsing should be the integral_constant type"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">always13</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"y"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"always13 should reject characters other than x"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.always"></a><a name="always"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.always" title="always">always</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.always.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.always.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.always.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">always</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.always.arguments"></a><p class="title"><b>Table 24.5. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">T</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a>
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.always.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.always.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.always.description">Description</a>
</h2>
<p>
It accepts an input if and only if <code class="computeroutput"><span class="identifier">P</span></code>
accepts it, but the result of parsing will be <code class="computeroutput"><span class="identifier">T</span></code>
instead of the result <code class="computeroutput"><span class="identifier">P</span></code>
returned.
</p>
<h2>
<a name="metaparse.reference.alphabetical.always.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.always.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.always.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">always</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.always.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.always.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.always.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser and <code class="computeroutput"><span class="identifier">t</span></code> class the following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">always</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">t</span><span class="special">&gt;</span>
<span class="identifier">last_of</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">return_</span><span class="special">&lt;</span><span class="identifier">t</span><span class="special">&gt;&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.always.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.always.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.always.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">always</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">always13</span> <span class="special">=</span> <span class="identifier">always</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'x'</span><span class="special">&gt;,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">always13</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"x"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"always13 should accept x"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
<span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">always13</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"x"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"the result of parsing should be the integral_constant type"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">always13</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"y"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"always13 should reject characters other than x"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.boost_metaparse_define_error"></a><a name="BOOST_METAPARSE_DEFINE_ERROR"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.boost_metaparse_define_error" title="BOOST_METAPARSE_DEFINE_ERROR">BOOST_METAPARSE_DEFINE_ERROR</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.boost_metaparse_define_error.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.boost_metaparse_define_error.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.boost_metaparse_define_error.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">BOOST_METAPARSE_DEFINE_ERROR</span><span class="special">(</span><span class="identifier">name</span><span class="special">,</span> <span class="identifier">msg</span><span class="special">)</span> <span class="special">\</span>
<span class="comment">// unspecified</span>
</pre>
<p>
This is a macro.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.boost_metaparse_define_error.arguments"></a><p class="title"><b>Table 24.6. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">name</span></code>
</p>
</td>
<td>
<p>
identifier token
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">msg</span></code>
</p>
</td>
<td>
<p>
string literal
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.boost_metaparse_define_error.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.boost_metaparse_define_error.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.boost_metaparse_define_error.description">Description</a>
</h2>
<p>
Macro for defining a <a class="link" href="reference.html#parsing_error_message">parsing error
message</a> class. <code class="computeroutput"><span class="identifier">name</span></code>
is the name of the class representing the error message and <code class="computeroutput"><span class="identifier">msg</span></code> is a string literal containing the
description of the error.
</p>
<h2>
<a name="metaparse.reference.alphabetical.boost_metaparse_define_error.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.boost_metaparse_define_error.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.boost_metaparse_define_error.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">define_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.boost_metaparse_define_error.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.boost_metaparse_define_error.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.boost_metaparse_define_error.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">n</span></code> name and <code class="computeroutput"><span class="identifier">m</span></code> string literal, given the following
is defined:
</p>
<pre class="programlisting"><span class="identifier">BOOST_METAPARSE_DEFINE_ERROR</span><span class="special">(</span><span class="identifier">n</span><span class="special">,</span> <span class="identifier">m</span><span class="special">);</span>
</pre>
<p>
the following pairs of expressions are equivalent:
</p>
<pre class="programlisting"><span class="identifier">n</span><span class="special">::</span><span class="identifier">get_value</span><span class="special">()</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(</span><span class="identifier">m</span><span class="special">)</span>
<span class="identifier">n</span><span class="special">::</span><span class="identifier">type</span>
<span class="identifier">n</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.boost_metaparse_define_error.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.boost_metaparse_define_error.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.boost_metaparse_define_error.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">define_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">repeated1</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">letter</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">token</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">sequence</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">change_error_message</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_message</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="identifier">BOOST_METAPARSE_DEFINE_ERROR</span><span class="special">(</span><span class="identifier">age_expected</span><span class="special">,</span> <span class="string">"Age expected"</span><span class="special">);</span>
<span class="keyword">using</span> <span class="identifier">name_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">repeated1</span><span class="special">&lt;</span><span class="identifier">letter</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">age_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">change_error_message</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">,</span> <span class="identifier">age_expected</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">name_age</span> <span class="special">=</span> <span class="identifier">sequence</span><span class="special">&lt;</span><span class="identifier">name_token</span><span class="special">,</span> <span class="identifier">age_token</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
<span class="identifier">age_expected</span><span class="special">,</span>
<span class="identifier">get_message</span><span class="special">&lt;</span><span class="identifier">name_age</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"Joe "</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"the error message should be age_expected when the age is missing"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.boost_metaparse_string"></a><a name="BOOST_METAPARSE_STRING"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.boost_metaparse_string" title="BOOST_METAPARSE_STRING">BOOST_METAPARSE_STRING</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.boost_metaparse_string.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.boost_metaparse_string.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.boost_metaparse_string.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="identifier">s</span><span class="special">)</span> <span class="special">\</span>
<span class="comment">// unspecified</span>
</pre>
<p>
This is a macro.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.boost_metaparse_string.arguments"></a><p class="title"><b>Table 24.7. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">s</span></code>
</p>
</td>
<td>
<p>
string literal
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.boost_metaparse_string.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.boost_metaparse_string.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.boost_metaparse_string.description">Description</a>
</h2>
<p>
Macro for defining <a class="link" href="reference.html#string"><code class="computeroutput"><span class="identifier">string</span></code></a>
values. <code class="computeroutput"><span class="identifier">s</span></code> is expected to
be a string literal. The macro requires C++11.
</p>
<p>
The maximal length of the string is limited. This limit is defined by the
<code class="computeroutput"><span class="identifier">BOOST_METAPARSE_LIMIT_STRING_SIZE</span></code>
macro.
</p>
<p>
On platforms where <code class="computeroutput"><span class="identifier">BOOST_METAPARSE_STRING</span></code>
is not supported, the <code class="computeroutput"><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span></code>
header defines the <code class="computeroutput"><span class="identifier">BOOST_METAPARSE_V1_CONFIG_NO_BOOST_METAPARSE_STRING</span></code>
macro. Defining this macro before including the header disables the <code class="computeroutput"><span class="identifier">BOOST_METAPARSE_STRING</span></code> macro.
</p>
<p>
The upper limit for the maximum length, which can be used is 2048. The
implementation of the <code class="computeroutput"><span class="identifier">BOOST_METAPARSE_STRING</span></code>
macro is generated using <code class="computeroutput"><span class="identifier">tools</span><span class="special">/</span><span class="identifier">string_headers</span><span class="special">.</span><span class="identifier">py</span></code> and
can be regenerated to extend this upper limit. Note that for Oracle Developer
Studio the string length limit is 127.
</p>
<p>
Metaparse supports changing the string length limit within a compilation
unit. To change the length limit, redefine the <code class="computeroutput"><span class="identifier">BOOST_METAPARSE_LIMIT_STRING_SIZE</span></code>
macro.
</p>
<p>
You can find benchmarks of this macro <a class="link" href="performance.html#BOOST_METAPARSE_STRING_benchmark">here</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.boost_metaparse_string.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.boost_metaparse_string.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.boost_metaparse_string.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.boost_metaparse_string.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.boost_metaparse_string.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.boost_metaparse_string.expression_semantics">Expression
semantics</a>
</h2>
<p>
The semantics of this macro is demonstrated by an example. The following
</p>
<pre class="programlisting"><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"hello"</span><span class="special">)</span>
</pre>
<p>
is equivalent to
</p>
<pre class="programlisting"><span class="identifier">string</span><span class="special">&lt;</span><span class="char">'h'</span><span class="special">,</span><span class="char">'e'</span><span class="special">,</span><span class="char">'l'</span><span class="special">,</span><span class="char">'l'</span><span class="special">,</span><span class="char">'o'</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.boost_metaparse_string.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.boost_metaparse_string.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.boost_metaparse_string.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">BOOST_METAPARSE_LIMIT_STRING_SIZE</span> <span class="number">8</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">hello1</span> <span class="special">=</span> <span class="identifier">string</span><span class="special">&lt;</span><span class="char">'H'</span><span class="special">,</span><span class="char">'e'</span><span class="special">,</span><span class="char">'l'</span><span class="special">,</span><span class="char">'l'</span><span class="special">,</span><span class="char">'o'</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">hello2</span> <span class="special">=</span> <span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"Hello"</span><span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
<span class="identifier">string</span><span class="special">&lt;</span><span class="char">'H'</span><span class="special">,</span> <span class="char">'e'</span><span class="special">,</span> <span class="char">'l'</span><span class="special">,</span> <span class="char">'l'</span><span class="special">,</span> <span class="char">'o'</span><span class="special">&gt;,</span>
<span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"Hello"</span><span class="special">)</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"The type generated by the macro should be identical to the hand-crafted one."</span>
<span class="special">);</span>
<span class="preprocessor">#undef</span> <span class="identifier">BOOST_METAPARSE_LIMIT_STRING_SIZE</span>
<span class="preprocessor">#define</span> <span class="identifier">BOOST_METAPARSE_LIMIT_STRING_SIZE</span> <span class="number">32</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
<span class="identifier">string</span><span class="special">&lt;</span>
<span class="char">'A'</span><span class="special">,</span> <span class="char">' '</span><span class="special">,</span> <span class="char">'l'</span><span class="special">,</span> <span class="char">'o'</span><span class="special">,</span> <span class="char">'n'</span><span class="special">,</span> <span class="char">'g'</span><span class="special">,</span> <span class="char">'e'</span><span class="special">,</span> <span class="char">'r'</span><span class="special">,</span>
<span class="char">' '</span><span class="special">,</span> <span class="char">'s'</span><span class="special">,</span> <span class="char">'t'</span><span class="special">,</span> <span class="char">'r'</span><span class="special">,</span> <span class="char">'i'</span><span class="special">,</span> <span class="char">'n'</span><span class="special">,</span> <span class="char">'g'</span>
<span class="special">&gt;,</span>
<span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"A longer string"</span><span class="special">)</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"The type generated by the macro should be identical to the hand-crafted one."</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.boost_metaparse_version"></a><a name="BOOST_METAPARSE_VERSION"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.boost_metaparse_version" title="BOOST_METAPARSE_VERSION">BOOST_METAPARSE_VERSION</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.boost_metaparse_version.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.boost_metaparse_version.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.boost_metaparse_version.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">BOOST_METAPARSE_VERSION</span> <span class="special">\\</span> <span class="identifier">unspecified</span>
</pre>
<p>
This is a macro.
</p>
<h2>
<a name="metaparse.reference.alphabetical.boost_metaparse_version.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.boost_metaparse_version.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.boost_metaparse_version.description">Description</a>
</h2>
<p>
Macro containing the version number of Boost.Metaparse.
</p>
<h2>
<a name="metaparse.reference.alphabetical.boost_metaparse_version.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.boost_metaparse_version.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.boost_metaparse_version.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">version</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.boost_metaparse_version.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.boost_metaparse_version.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.boost_metaparse_version.expression_semantics">Expression
semantics</a>
</h2>
<p>
It has major, minor and release components:
</p>
<pre class="programlisting"><span class="identifier">major</span> <span class="special">==</span> <span class="identifier">BOOST_METAPARSE_VERSION</span> <span class="special">/</span> <span class="number">10000000</span>
<span class="identifier">minor</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">BOOST_METAPARSE_VERSION</span> <span class="special">%</span> <span class="number">10000000</span><span class="special">)</span> <span class="special">/</span> <span class="number">100000</span>
<span class="identifier">release</span> <span class="special">==</span> <span class="identifier">BOOST_METAPARSE_VERSION</span> <span class="special">%</span> <span class="number">100000</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.boxed_value"></a><a name="boxed_value"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.boxed_value" title="Boxed value">Boxed
value</a>
</h4></div></div></div>
<p>
A <span class="emphasis"><em>boxed value</em></span> is a type representing a constant value.
It has a public static <code class="computeroutput"><span class="keyword">const</span></code>
or <code class="computeroutput"><span class="keyword">constexpr</span></code> member called
<code class="computeroutput"><span class="identifier">value</span></code>. The class represents
that value as a type, so it can be manipulated by <a class="link" href="reference.html#metafunction">template
metafunction</a>s. It has to be a <a class="link" href="reference.html#metaprogramming_value">template
metaprogramming value</a>.
</p>
<p>
For example the following <code class="computeroutput"><span class="keyword">struct</span></code>
represents the <code class="computeroutput"><span class="keyword">true</span></code> value
of type <code class="computeroutput"><span class="keyword">bool</span></code>:
</p>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">true_type</span>
<span class="special">{</span>
<span class="keyword">static</span> <span class="keyword">constexpr</span> <span class="keyword">bool</span> <span class="identifier">value</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span> <span class="identifier">true_type</span><span class="special">;</span>
<span class="special">};</span>
</pre>
<p>
The <code class="computeroutput"><span class="identifier">value</span></code> member is the
wrapped value. <code class="computeroutput"><span class="identifier">true_type</span><span class="special">::</span><span class="identifier">type</span></code>
is an alias of <code class="computeroutput"><span class="identifier">true_type</span></code>
which makes it a template metaprogramming value.
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.build_parser"></a><a name="build_parser"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.build_parser" title="build_parser">build_parser</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.build_parser.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.build_parser.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.build_parser.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">build_parser</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#metafunction">template metafunction</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.build_parser.arguments"></a><p class="title"><b>Table 24.8. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.build_parser.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.build_parser.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.build_parser.description">Description</a>
</h2>
<p>
It generates a simple interface for parser. It returns a metafunction class
that takes an input string, parses it with <code class="computeroutput"><span class="identifier">P</span></code>
and returns the result of parsing. It generates a compilation error when
parsing fails.
</p>
<h2>
<a name="metaparse.reference.alphabetical.build_parser.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.build_parser.return_value"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.build_parser.return_value">Return
value</a>
</h2>
<p>
It returns a <a class="link" href="reference.html#metafunction_class">template metafunction class</a>:
</p>
<pre class="programlisting"><span class="keyword">struct</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">S</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">apply</span><span class="special">;</span>
<span class="special">};</span>
</pre>
<div class="table">
<a name="metaparse.reference.alphabetical.build_parser.arguments0"></a><p class="title"><b>Table 24.9. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">S</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#string">string</a>
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.build_parser.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.build_parser.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.build_parser.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">build_parser</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.build_parser.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.build_parser.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.build_parser.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser and <code class="computeroutput"><span class="identifier">s</span></code> compile-time string
</p>
<pre class="programlisting"><span class="identifier">build_parser</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">&gt;</span>
</pre>
<p>
is equivalent to
</p>
<pre class="programlisting"><span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">&gt;&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.build_parser.h5"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.build_parser.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.build_parser.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">build_parser</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">string_to_int</span> <span class="special">=</span> <span class="identifier">build_parser</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">string_to_int</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"1113"</span><span class="special">)&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">1113</span><span class="special">,</span>
<span class="string">"string_to_int should be a metafunction turning a string into an int"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.change_error_message"></a><a name="change_error_message"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.change_error_message" title="change_error_message">change_error_message</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.change_error_message.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.change_error_message.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.change_error_message.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Msg</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">change_error_message</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.change_error_message.arguments"></a><p class="title"><b>Table 24.10. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Msg</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parsing_error_message">parsing error message</a>
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.change_error_message.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.change_error_message.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.change_error_message.description">Description</a>
</h2>
<p>
It applies <code class="computeroutput"><span class="identifier">P</span></code> on the input.
When <code class="computeroutput"><span class="identifier">P</span></code> succeeds, <code class="computeroutput"><span class="identifier">change_error_message</span></code> returns the result
<code class="computeroutput"><span class="identifier">P</span></code> returns, otherwise <code class="computeroutput"><span class="identifier">change_error_message</span></code> rejects the input
and the reason will be <code class="computeroutput"><span class="identifier">Msg</span></code>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.change_error_message.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.change_error_message.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.change_error_message.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">change_error_message</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.change_error_message.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.change_error_message.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.change_error_message.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser and <code class="computeroutput"><span class="identifier">m</span></code> parsing error message, <code class="computeroutput"><span class="identifier">s</span></code> compile-time string and <code class="computeroutput"><span class="identifier">pos</span></code> source position
</p>
<pre class="programlisting"><span class="identifier">change_error_message</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">msg</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<p>
is equivalent to <code class="computeroutput"><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span></code> when <code class="computeroutput"><span class="identifier">p</span></code>
accepts the input. It is equivalent to <code class="computeroutput"><span class="identifier">fail</span><span class="special">&lt;</span><span class="identifier">msg</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span></code> otherwise.
</p>
<h2>
<a name="metaparse.reference.alphabetical.change_error_message.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.change_error_message.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.change_error_message.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">change_error_message</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">repeated1</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">letter</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">keyword</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">last_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">token</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_message</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">define_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="identifier">BOOST_METAPARSE_DEFINE_ERROR</span><span class="special">(</span><span class="identifier">name_expected</span><span class="special">,</span> <span class="string">"Name expected"</span><span class="special">);</span>
<span class="keyword">using</span> <span class="identifier">keyword_name</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">keyword</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"name"</span><span class="special">)&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">name_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">repeated1</span><span class="special">&lt;</span><span class="identifier">letter</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">name_parser</span> <span class="special">=</span>
<span class="identifier">last_of</span><span class="special">&lt;</span><span class="identifier">keyword_name</span><span class="special">,</span> <span class="identifier">change_error_message</span><span class="special">&lt;</span><span class="identifier">name_token</span><span class="special">,</span> <span class="identifier">name_expected</span><span class="special">&gt;&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">name_parser</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"name Bela"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"name_parser should accept \"name &lt;a name&gt;\""</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">name_parser</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"name ?"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"name_parser should reject input when name is a question mark"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
<span class="identifier">get_message</span><span class="special">&lt;</span>
<span class="identifier">name_parser</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"name ?"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="identifier">name_expected</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"the error message should be the one specified by change_error_message"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.currying"></a><a name="currying"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.currying" title="Currying">Currying</a>
</h4></div></div></div>
<p>
A <a class="link" href="reference.html#metafunction">template metafunction</a> supports <span class="emphasis"><em>currying</em></span>
when it accepts less arguments than it normally expects. When less arguments
are provided, then it returns a <a class="link" href="reference.html#metafunction_class">template
metafunction class</a> expecting the remaining arguments. That template
metafunction class is also expected to support currying.
</p>
<p>
For example assuming the following metafunction is given:
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">B</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">plus</span><span class="special">;</span>
</pre>
<p>
It takes two values, adds them and returns their result. For example:
</p>
<pre class="programlisting"><span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">plus</span><span class="special">&lt;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">11</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">2</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">13</span><span class="special">,</span>
<span class="string">"This should work"</span>
<span class="special">);</span>
</pre>
<p>
If it supports currying, then the following should also work:
</p>
<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">inc</span> <span class="special">=</span> <span class="identifier">plus</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">1</span><span class="special">&gt;&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">inc</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">12</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">13</span><span class="special">,</span>
<span class="string">"This should work"</span>
<span class="special">);</span>
</pre>
<p>
The above example defines the <code class="computeroutput"><span class="identifier">inc</span></code>
template metafunction class by calling <code class="computeroutput"><span class="identifier">plus</span></code>
with just one argument: the <a class="link" href="reference.html#boxed_value">boxed</a> <code class="computeroutput"><span class="number">1</span></code> value.
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.debug_parsing_error"></a><a name="debug_parsing_error"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.debug_parsing_error" title="debug_parsing_error">debug_parsing_error</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.debug_parsing_error.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.debug_parsing_error.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.debug_parsing_error.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">S</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">debug_parsing_error</span>
<span class="special">{</span>
<span class="identifier">debug_parsing_error</span><span class="special">();</span>
<span class="special">};</span>
</pre>
<p>
This is a template class.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.debug_parsing_error.arguments"></a><p class="title"><b>Table 24.11. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">S</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#string">string</a>
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.debug_parsing_error.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.debug_parsing_error.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.debug_parsing_error.description">Description</a>
</h2>
<p>
Utility to debug errors generated by a compile-time parser. An instance
of the instantiated template class has to be created and initialised using
the default constructor. When parsing the input string using the parser
generates an error, the default constructor of <code class="computeroutput"><span class="identifier">debug_parsing_error</span></code>
prints the error message to the standard output at run-time and calls
<code class="computeroutput"><span class="identifier">exit</span></code>.
</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
Note that more powerful debugging utilities, like <a href="https://github.com/sabel83/metashell#metashell" target="_top">Metashell</a>
are also available.
</p></td></tr>
</table></div>
<h2>
<a name="metaparse.reference.alphabetical.debug_parsing_error.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.debug_parsing_error.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.debug_parsing_error.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">debug_parsing_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.debug_parsing_error.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.debug_parsing_error.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.debug_parsing_error.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> compile-time
parser and <code class="computeroutput"><span class="identifier">s</span></code> compile-time
string
</p>
<pre class="programlisting"><span class="identifier">debug_parsing_error</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">s</span><span class="special">&gt;()</span>
</pre>
<p>
Tries to parse <code class="computeroutput"><span class="identifier">s</span></code> using
<code class="computeroutput"><span class="identifier">p</span></code> at compile-time. At run-time
the constructor prints the result of parsing to the standard output and
calls <code class="computeroutput"><span class="identifier">exit</span></code>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.debug_parsing_error.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.debug_parsing_error.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.debug_parsing_error.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">debug_parsing_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="identifier">debug_parsing_error</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">,</span> <span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"not an int"</span><span class="special">)&gt;</span> <span class="identifier">do_debugging</span><span class="special">;</span>
<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> <span class="special">{}</span>
</pre>
<p>
By running the compiled executable you get the following:
</p>
<p>
Compile-time parsing results ---------------------------- Input text: not
an int
</p>
<p>
Parsing failed: line 1, col 1: Digit expected
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.digit_expected"></a><a name="digit_expected"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.digit_expected" title="digit_expected">digit_expected</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.digit_expected.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.digit_expected.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.digit_expected.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">error</span>
<span class="special">{</span>
<span class="keyword">struct</span> <span class="identifier">digit_expected</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parsing_error_message">parsing error message</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.digit_expected.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.digit_expected.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.digit_expected.description">Description</a>
</h2>
<p>
Class representing the error that a digit character was expected at a specific
location.
</p>
<h2>
<a name="metaparse.reference.alphabetical.digit_expected.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.digit_expected.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.digit_expected.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">error</span><span class="special">/</span><span class="identifier">digit_expected</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.digit"></a><a name="digit"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.digit" title="digit">digit</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.digit.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.digit.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.digit.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">digit</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser">parser</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.digit.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.digit.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.digit.description">Description</a>
</h2>
<p>
Parser accepting one character in the range <code class="computeroutput"><span class="number">0</span><span class="special">-</span><span class="number">9</span></code>. The result
of the parser is the accepted character.
</p>
<h2>
<a name="metaparse.reference.alphabetical.digit.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.digit.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.digit.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">digit</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.digit.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.digit.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.digit.expression_semantics">Expression
semantics</a>
</h2>
<p>
The following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">digit</span>
<span class="identifier">accept_when</span><span class="special">&lt;</span><span class="identifier">one_char</span><span class="special">,</span> <span class="identifier">util</span><span class="special">::</span><span class="identifier">is_digit</span><span class="special">,</span> <span class="identifier">error</span><span class="special">::</span><span class="identifier">digit_expected</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.digit.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.digit.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.digit.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">digit</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">digit</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"0"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"digit should accept a digit"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">digit</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"x"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"digit should reject a character"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">digit</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"0"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="char">'0'</span><span class="special">,</span>
<span class="string">"the result of parsing should be the character value"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.digit_to_int_c"></a><a name="digit_to_int_c"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.digit_to_int_c" title="digit_to_int_c">digit_to_int_c</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.digit_to_int_c.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.digit_to_int_c.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.digit_to_int_c.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">util</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">char</span> <span class="identifier">D</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">digit_to_int_c</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
This is a template class similar to a <a class="link" href="reference.html#metafunction">template
metafunction</a> but taking a <code class="computeroutput"><span class="keyword">char</span></code>
value as argument.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.digit_to_int_c.arguments"></a><p class="title"><b>Table 24.12. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">D</span></code>
</p>
</td>
<td>
<p>
character value
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.digit_to_int_c.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.digit_to_int_c.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.digit_to_int_c.description">Description</a>
</h2>
<p>
Converts a character containing a value in the range <code class="computeroutput"><span class="special">[</span><span class="char">'0'</span><span class="special">..</span><span class="char">'9'</span><span class="special">]</span></code> to an integer.
</p>
<h2>
<a name="metaparse.reference.alphabetical.digit_to_int_c.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.digit_to_int_c.return_value"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.digit_to_int_c.return_value">Return
value</a>
</h2>
<p>
It returns a <a class="link" href="reference.html#boxed_value">boxed</a> integer value.
</p>
<h2>
<a name="metaparse.reference.alphabetical.digit_to_int_c.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.digit_to_int_c.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.digit_to_int_c.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">digit_to_int_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.digit_to_int_c.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.digit_to_int_c.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.digit_to_int_c.expression_semantics">Expression
semantics</a>
</h2>
<p>
The following pairs of expressions are equivalent
</p>
<pre class="programlisting"><span class="identifier">digit_to_int_c</span><span class="special">&lt;</span><span class="char">'0'</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;</span>
<span class="identifier">digit_to_int_c</span><span class="special">&lt;</span><span class="char">'9'</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">9</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.digit_to_int_c.h5"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.digit_to_int_c.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.digit_to_int_c.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">digit_to_int_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">digit_to_int_c</span><span class="special">&lt;</span><span class="char">'0'</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">0</span><span class="special">,</span>
<span class="string">"it should convert a character to the corresponding integer value"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">digit_to_int_c</span><span class="special">&lt;</span><span class="char">'3'</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">3</span><span class="special">,</span>
<span class="string">"it should convert a character to the corresponding integer value"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">digit_to_int_c</span><span class="special">&lt;</span><span class="char">'9'</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">9</span><span class="special">,</span>
<span class="string">"it should convert a character to the corresponding integer value"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.digit_to_int"></a><a name="digit_to_int"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.digit_to_int" title="digit_to_int">digit_to_int</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.digit_to_int.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.digit_to_int.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.digit_to_int.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">util</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">D</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">digit_to_int</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
This is a <a class="link" href="reference.html#lazy_metafunction">lazy template metafunction</a>
that supports <a class="link" href="reference.html#currying">currying</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.digit_to_int.arguments"></a><p class="title"><b>Table 24.13. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">D</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#boxed_value">boxed</a> character value
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.digit_to_int.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.digit_to_int.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.digit_to_int.description">Description</a>
</h2>
<p>
Converts a boxed character containing a value in the range <code class="computeroutput"><span class="special">[</span><span class="char">'0'</span><span class="special">..</span><span class="char">'9'</span><span class="special">]</span></code> to an
integer.
</p>
<h2>
<a name="metaparse.reference.alphabetical.digit_to_int.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.digit_to_int.return_value"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.digit_to_int.return_value">Return
value</a>
</h2>
<p>
It returns a <a class="link" href="reference.html#boxed_value">boxed</a> integer value.
</p>
<h2>
<a name="metaparse.reference.alphabetical.digit_to_int.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.digit_to_int.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.digit_to_int.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">digit_to_int</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.digit_to_int.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.digit_to_int.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.digit_to_int.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">C</span></code> boxed character
value in the range <code class="computeroutput"><span class="special">[</span><span class="char">'0'</span><span class="special">..</span><span class="char">'9'</span><span class="special">]</span></code>
the following expressions are equivalent
</p>
<pre class="programlisting"><span class="identifier">digit_to_int</span><span class="special">&lt;&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="identifier">digit_to_int</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="identifier">digit_to_int_c</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">&gt;::</span><span class="identifier">type</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.digit_to_int.h5"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.digit_to_int.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.digit_to_int.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">digit_to_int</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">struct</span> <span class="identifier">nullary_metafunction_returning_4</span>
<span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'4'</span><span class="special">&gt;;</span>
<span class="special">};</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">digit_to_int</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'0'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">0</span><span class="special">,</span>
<span class="string">"it should convert a character to the corresponding integer value"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">digit_to_int</span><span class="special">&lt;&gt;::</span><span class="identifier">type</span>
<span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'7'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">7</span><span class="special">,</span>
<span class="string">"it should support currying"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">digit_to_int</span><span class="special">&lt;</span><span class="identifier">nullary_metafunction_returning_4</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">4</span><span class="special">,</span>
<span class="string">"it should support lazy evaluation"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.digit_val"></a><a name="digit_val"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.digit_val" title="digit_val">digit_val</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.digit_val.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.digit_val.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.digit_val.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">digit_val</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser">parser</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.digit_val.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.digit_val.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.digit_val.description">Description</a>
</h2>
<p>
It accepts one character in the range <code class="computeroutput"><span class="number">0</span><span class="special">-</span><span class="number">9</span></code>. The result
of the parser is the value represented by the accepted character.
</p>
<h2>
<a name="metaparse.reference.alphabetical.digit_val.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.digit_val.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.digit_val.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">digit_val</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.digit_val.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.digit_val.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.digit_val.expression_semantics">Expression
semantics</a>
</h2>
<p>
The following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">digit_val</span>
<span class="identifier">transform</span><span class="special">&lt;</span><span class="identifier">digit</span><span class="special">,</span> <span class="identifier">util</span><span class="special">::</span><span class="identifier">digit_to_int</span><span class="special">&lt;&gt;&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.digit_val.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.digit_val.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.digit_val.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">digit_val</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">digit_val</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"0"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"digit_val should accept a digit"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">digit_val</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"x"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"digit_val should reject a character"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">digit_val</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"0"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">0</span><span class="special">,</span>
<span class="string">"the result of parsing should be the int value"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.empty"></a><a name="empty"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.empty" title="empty">empty</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.empty.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.empty.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.empty.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Result</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">empty</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser">parser</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.empty.arguments"></a><p class="title"><b>Table 24.14. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Result</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a>
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.empty.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.empty.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.empty.description">Description</a>
</h2>
<p>
It accepts empty input only. The result of parsing is the <code class="computeroutput"><span class="identifier">Result</span></code> argument.
</p>
<h2>
<a name="metaparse.reference.alphabetical.empty.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.empty.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.empty.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">empty</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.empty.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.empty.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.empty.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">c</span></code> class the following
are equivalent:
</p>
<pre class="programlisting"><span class="identifier">empty</span><span class="special">&lt;</span><span class="identifier">c</span><span class="special">&gt;</span>
<span class="identifier">except</span><span class="special">&lt;</span><span class="identifier">one_char</span><span class="special">,</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">error</span><span class="special">::</span><span class="identifier">end_of_input_expected</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.empty.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.empty.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.empty.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">empty</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">want_empty</span> <span class="special">=</span> <span class="identifier">empty</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"result"</span><span class="special">)&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">want_empty</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">""</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"empty accepts the empty input"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">want_empty</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"x"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"empty should reject non-empty input"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
<span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">want_empty</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">""</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"result"</span><span class="special">)</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"the result of parsing should be the given value"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.end_of_input_expected"></a><a name="end_of_input_expected"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.end_of_input_expected" title="end_of_input_expected">end_of_input_expected</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.end_of_input_expected.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.end_of_input_expected.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.end_of_input_expected.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">error</span>
<span class="special">{</span>
<span class="keyword">struct</span> <span class="identifier">end_of_input_expected</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parsing_error_message">parsing error message</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.end_of_input_expected.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.end_of_input_expected.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.end_of_input_expected.description">Description</a>
</h2>
<p>
Class representing the error that the input contains more characters than
it should.
</p>
<h2>
<a name="metaparse.reference.alphabetical.end_of_input_expected.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.end_of_input_expected.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.end_of_input_expected.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">error</span><span class="special">/</span><span class="identifier">end_of_input_expected</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.entire_input"></a><a name="entire_input"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.entire_input" title="entire_input">entire_input</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.entire_input.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.entire_input.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.entire_input.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Msg</span> <span class="special">=</span> <span class="identifier">error</span><span class="special">::</span><span class="identifier">end_of_input_expected</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">entire_input</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.entire_input.arguments"></a><p class="title"><b>Table 24.15. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Msg</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parsing_error_message">parsing error message</a>
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.entire_input.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.entire_input.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.entire_input.description">Description</a>
</h2>
<p>
It parses the input using <code class="computeroutput"><span class="identifier">P</span></code>
and checks if it consumes the entire input. If <code class="computeroutput"><span class="identifier">P</span></code>
fails or doesn't consume the entire input, <code class="computeroutput"><span class="identifier">entire_input</span></code>
fails. Otherwise <code class="computeroutput"><span class="identifier">entire_input</span></code>
returns the result of <code class="computeroutput"><span class="identifier">P</span></code>.
When <code class="computeroutput"><span class="identifier">P</span></code> does not consume
the entire input, the error message returned by <code class="computeroutput"><span class="identifier">entire_input</span></code>
is <code class="computeroutput"><span class="identifier">Msg</span></code>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.entire_input.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.entire_input.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.entire_input.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">entire_input</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.entire_input.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.entire_input.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.entire_input.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser and <code class="computeroutput"><span class="identifier">e</span></code> parsing error message the following
are equivalent
</p>
<pre class="programlisting"><span class="identifier">entire_input</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">e</span><span class="special">&gt;</span>
<span class="identifier">first_of</span><span class="special">&lt;</span>
<span class="identifier">p</span><span class="special">,</span>
<span class="identifier">change_error_message</span><span class="special">&lt;</span><span class="identifier">empty</span><span class="special">&lt;/*</span> <span class="identifier">some</span> <span class="identifier">metaprogramming</span> <span class="identifier">value</span> <span class="special">*/&gt;,</span> <span class="identifier">e</span><span class="special">&gt;</span>
<span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.entire_input.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.entire_input.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.entire_input.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">entire_input</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_message</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">define_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="identifier">BOOST_METAPARSE_DEFINE_ERROR</span><span class="special">(</span><span class="identifier">extra_chars_at_end</span><span class="special">,</span> <span class="string">"Extra chars at end"</span><span class="special">);</span>
<span class="keyword">using</span> <span class="identifier">int_parser</span> <span class="special">=</span> <span class="identifier">entire_input</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">,</span> <span class="identifier">extra_chars_at_end</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">int_parser</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"1113"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">1113</span><span class="special">,</span>
<span class="string">"it should parse the input if it contains only an integer"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
<span class="identifier">get_message</span><span class="special">&lt;</span>
<span class="identifier">int_parser</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"1113mm"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="identifier">extra_chars_at_end</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should return the specified error message when there are extra characters"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.except"></a><a name="except"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.except" title="except">except</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.except.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.except.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.except.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Result</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">ErrorMsg</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">except</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.except.arguments"></a><p class="title"><b>Table 24.16. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Result</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">ErrorMsg</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parsing_error_message">parsing error message</a>
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.except.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.except.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.except.description">Description</a>
</h2>
<p>
<code class="computeroutput"><span class="identifier">except</span></code> accepts the input
when <code class="computeroutput"><span class="identifier">P</span></code> rejects it and the
result of parsing is the <code class="computeroutput"><span class="identifier">Result</span></code>
argument. When <code class="computeroutput"><span class="identifier">P</span></code> accepts
the input, <code class="computeroutput"><span class="identifier">except</span></code> rejects
it and the reason is <code class="computeroutput"><span class="identifier">ErrorMsg</span></code>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.except.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.except.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.except.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">except</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.except.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.except.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.except.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser, <code class="computeroutput"><span class="identifier">c</span></code> class, <code class="computeroutput"><span class="identifier">msg</span></code>
parsing error message, <code class="computeroutput"><span class="identifier">s</span></code>
compile-time string and <code class="computeroutput"><span class="identifier">pos</span></code>
source position the following are equivalent
</p>
<pre class="programlisting"><span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">except</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">msg</span><span class="special">&gt;,</span> <span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="identifier">c</span>
<span class="identifier">get_remaining</span><span class="special">&lt;</span><span class="identifier">except</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">msg</span><span class="special">&gt;,</span> <span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="identifier">s</span>
<span class="identifier">get_position</span><span class="special">&lt;</span><span class="identifier">except</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">msg</span><span class="special">&gt;,</span> <span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="identifier">pos</span>
</pre>
<p>
when <code class="computeroutput"><span class="identifier">p</span></code> rejects the input.
The result of the parser is an error with the error message <code class="computeroutput"><span class="identifier">msg</span></code> otherwise.
</p>
<h2>
<a name="metaparse.reference.alphabetical.except.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.except.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.except.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">except</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_message</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">define_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="identifier">BOOST_METAPARSE_DEFINE_ERROR</span><span class="special">(</span>
<span class="identifier">number_is_not_allowed</span><span class="special">,</span>
<span class="string">"numbers are not allowed here"</span>
<span class="special">);</span>
<span class="keyword">using</span> <span class="identifier">except_int</span> <span class="special">=</span>
<span class="identifier">except</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">1</span><span class="special">&gt;,</span> <span class="identifier">number_is_not_allowed</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">except_int</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"foo"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">1</span><span class="special">,</span>
<span class="string">"it should accept the input when it is not an integer"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
<span class="identifier">number_is_not_allowed</span><span class="special">,</span>
<span class="identifier">get_message</span><span class="special">&lt;</span><span class="identifier">except_int</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"13"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should reject the input when it is an integer"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.expected_to_fail"></a><a name="expected_to_fail"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.expected_to_fail" title="expected_to_fail">expected_to_fail</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.expected_to_fail.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.expected_to_fail.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.expected_to_fail.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">error</span>
<span class="special">{</span>
<span class="keyword">struct</span> <span class="identifier">expected_to_fail</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parsing_error_message">parsing error message</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.expected_to_fail.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.expected_to_fail.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.expected_to_fail.description">Description</a>
</h2>
<p>
Class representing the error that a parser was expected to fail but it
did not fail.
</p>
<h2>
<a name="metaparse.reference.alphabetical.expected_to_fail.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.expected_to_fail.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.expected_to_fail.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">error</span><span class="special">/</span><span class="identifier">expected_to_fail</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.fail_at_first_char_expected"></a><a name="fail_at_first_char_expected"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.fail_at_first_char_expected" title="fail_at_first_char_expected">fail_at_first_char_expected</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.fail_at_first_char_expected.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.fail_at_first_char_expected.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.fail_at_first_char_expected.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">fail_at_first_char_expected</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.fail_at_first_char_expected.arguments"></a><p class="title"><b>Table 24.17. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.fail_at_first_char_expected.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.fail_at_first_char_expected.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.fail_at_first_char_expected.description">Description</a>
</h2>
<p>
It tries to parse the input using <code class="computeroutput"><span class="identifier">P</span></code>.
When <code class="computeroutput"><span class="identifier">P</span></code> rejects the input
without consuming any character, <code class="computeroutput"><span class="identifier">fail_at_first_char_expected</span></code>
accepts the input. Otherwise (when <code class="computeroutput"><span class="identifier">P</span></code>
accepts the input or when it consumes characters before rejecting the input)
<code class="computeroutput"><span class="identifier">fail_at_first_char_expected</span></code>
rejects the input.
</p>
<h2>
<a name="metaparse.reference.alphabetical.fail_at_first_char_expected.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.fail_at_first_char_expected.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.fail_at_first_char_expected.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">fail_at_first_char_expected</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.fail_at_first_char_expected.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.fail_at_first_char_expected.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.fail_at_first_char_expected.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser, <code class="computeroutput"><span class="identifier">s</span></code> compile-time string and <code class="computeroutput"><span class="identifier">pos</span></code> source position:
</p>
<p>
When <code class="computeroutput"><span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span></code>
is false, the following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">fail_at_first_char_expected</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="identifier">reject</span><span class="special">&lt;</span><span class="identifier">error</span><span class="special">::</span><span class="identifier">expected_to_fail</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<p>
When <code class="computeroutput"><span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span></code>
is true and <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">equal_to</span><span class="special">&lt;</span><span class="identifier">pos</span><span class="special">,</span> <span class="identifier">get_position</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
is also true, the following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">get_remaining</span><span class="special">&lt;</span><span class="identifier">except</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">msg</span><span class="special">&gt;,</span> <span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="identifier">accept</span><span class="special">&lt;/*</span> <span class="identifier">unspecified</span> <span class="special">*/,</span> <span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<p>
Otherwise the following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">get_remaining</span><span class="special">&lt;</span><span class="identifier">except</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">msg</span><span class="special">&gt;,</span> <span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;::</span><span class="identifier">type</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.fail_at_first_char_expected.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.fail_at_first_char_expected.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.fail_at_first_char_expected.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">fail_at_first_char_expected</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">foldl_start_with_parser</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">first_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">last_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">lambda</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">plus</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">plus_int</span> <span class="special">=</span> <span class="identifier">last_of</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'+'</span><span class="special">&gt;,</span> <span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_exp</span> <span class="special">=</span>
<span class="identifier">first_of</span><span class="special">&lt;</span>
<span class="identifier">foldl_start_with_parser</span><span class="special">&lt;</span>
<span class="identifier">plus_int</span><span class="special">,</span>
<span class="identifier">int_</span><span class="special">,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">plus</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_1</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_2</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;,</span>
<span class="identifier">fail_at_first_char_expected</span><span class="special">&lt;</span><span class="identifier">plus_int</span><span class="special">&gt;</span>
<span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">plus_exp</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"1+2+3"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">6</span><span class="special">,</span>
<span class="string">"it should accept the input when it is a list of '+' separated ints"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">plus_exp</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"1+2+3+"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should reject the input when it has an extra +"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.fail"></a><a name="fail"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.fail" title="fail">fail</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.fail.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.fail.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.fail.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Msg</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">fail</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser">parser</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.fail.arguments"></a><p class="title"><b>Table 24.18. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Msg</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parsing_error_message">parsing error message</a>
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.fail.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.fail.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.fail.description">Description</a>
</h2>
<p>
Parser rejecting every input.
</p>
<h2>
<a name="metaparse.reference.alphabetical.fail.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.fail.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.fail.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">fail</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.fail.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.fail.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.fail.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">msg</span></code> parsing error
message, <code class="computeroutput"><span class="identifier">s</span></code> compile-time
string and <code class="computeroutput"><span class="identifier">pos</span></code> source position
</p>
<pre class="programlisting"><span class="identifier">fail</span><span class="special">&lt;</span><span class="identifier">msg</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;::</span><span class="identifier">type</span>
</pre>
<p>
returns an error with <code class="computeroutput"><span class="identifier">msg</span></code>
as the error message.
</p>
<h2>
<a name="metaparse.reference.alphabetical.fail.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.fail.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.fail.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">fail</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_message</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">define_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="identifier">BOOST_METAPARSE_DEFINE_ERROR</span><span class="special">(</span><span class="identifier">sample_error</span><span class="special">,</span> <span class="string">"This is an example parsing error"</span><span class="special">);</span>
<span class="keyword">using</span> <span class="identifier">fail_p</span> <span class="special">=</span> <span class="identifier">fail</span><span class="special">&lt;</span><span class="identifier">sample_error</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">fail_p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"foo"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should reject every input"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
<span class="identifier">get_message</span><span class="special">&lt;</span><span class="identifier">fail_p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"foo"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="identifier">sample_error</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"the error message should be the type specified"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.fail_tag"></a><a name="fail_tag"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.fail_tag" title="fail_tag">fail_tag</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.fail_tag.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.fail_tag.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.fail_tag.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">fail_tag</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#tag">tag</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.fail_tag.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.fail_tag.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.fail_tag.description">Description</a>
</h2>
<p>
This is the tag of the values returned by a parser when parsing was not
successful.
</p>
<h2>
<a name="metaparse.reference.alphabetical.fail_tag.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.fail_tag.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.fail_tag.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">fail_tag</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.first_of"></a><a name="first_of"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.first_of" title="first_of">first_of</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.first_of.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.first_of.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.first_of.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span><span class="special">...</span> <span class="identifier">Ps</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">first_of</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.first_of.arguments"></a><p class="title"><b>Table 24.19. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Ps</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>s
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.first_of.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.first_of.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.first_of.description">Description</a>
</h2>
<p>
<code class="computeroutput"><span class="identifier">first_of</span></code> applies the <code class="computeroutput"><span class="identifier">Ps</span><span class="special">...</span></code>
parsers in sequence. It accepts an input when all parsers accept it. The
result of parsing is the result of the first parser.
</p>
<p>
On compilers, which are not C++11-compliant, the maximum number of parsers
<code class="computeroutput"><span class="identifier">first_of</span></code> accepts can be
specified with the <code class="computeroutput"><span class="identifier">BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE</span></code>
macro. Its default value is <code class="computeroutput"><span class="number">5</span></code>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.first_of.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.first_of.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.first_of.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">first_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.first_of.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.first_of.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.first_of.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p1</span></code>, ... <code class="computeroutput"><span class="identifier">pn</span></code> parsers
</p>
<pre class="programlisting"><span class="identifier">first_of</span><span class="special">&lt;</span><span class="identifier">p1</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">pn</span><span class="special">&gt;</span>
</pre>
<p>
is equivalent to
</p>
<pre class="programlisting"><span class="identifier">nth_of_c</span><span class="special">&lt;</span><span class="number">0</span><span class="special">,</span> <span class="identifier">p1</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">pn</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.first_of.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.first_of.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.first_of.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">first_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">int_with_semicolon</span> <span class="special">=</span> <span class="identifier">first_of</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">,</span> <span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">';'</span><span class="special">&gt;&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">int_with_semicolon</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"13"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"int without semicolon is rejected"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">int_with_semicolon</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"13;"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"the result is the result of the first parser"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.foldl1"></a><a name="foldl1"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl1" title="foldl1">foldl1</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.foldl1.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl1.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl1.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">State</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">ForwardOp</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">foldl1</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.foldl1.arguments"></a><p class="title"><b>Table 24.20. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">State</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">ForwardOp</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metafunction_class">template metafunction class</a>
taking two arguments
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.foldl1.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl1.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl1.description">Description</a>
</h2>
<p>
<code class="computeroutput"><span class="identifier">foldl1</span></code> applies <code class="computeroutput"><span class="identifier">P</span></code> on the input string repeatedly as long
as <code class="computeroutput"><span class="identifier">P</span></code> accepts the input.
The result of parsing is equivalent to <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">fold</span><span class="special">&lt;</span><span class="identifier">Sequence</span><span class="special">,</span> <span class="identifier">State</span><span class="special">,</span> <span class="identifier">ForwardOp</span><span class="special">&gt;</span></code>, where <code class="computeroutput"><span class="identifier">Sequence</span></code>
is the sequence of the results of the applications of <code class="computeroutput"><span class="identifier">P</span></code>.
</p>
<p>
When <code class="computeroutput"><span class="identifier">P</span></code> rejects the input
for the first time, <code class="computeroutput"><span class="identifier">foldl1</span></code>
rejects it as well. At least one successful application of <code class="computeroutput"><span class="identifier">P</span></code> is required for <code class="computeroutput"><span class="identifier">foldl1</span></code>
to accept the input.
</p>
<h2>
<a name="metaparse.reference.alphabetical.foldl1.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl1.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl1.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">foldl1</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.foldl1.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl1.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl1.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser, <code class="computeroutput"><span class="identifier">t</span></code> class, <code class="computeroutput"><span class="identifier">f</span></code>
metafunction class taking two arguments the following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">foldl1</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">t</span><span class="special">,</span> <span class="identifier">f</span><span class="special">&gt;</span>
<span class="identifier">last_of</span><span class="special">&lt;</span><span class="identifier">look_ahead</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">&gt;,</span> <span class="identifier">foldl</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">t</span><span class="special">,</span> <span class="identifier">f</span><span class="special">&gt;&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.foldl1.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl1.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl1.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">foldl1</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">token</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">lambda</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">plus</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">sum_op</span> <span class="special">=</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">plus</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_1</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_2</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">ints</span> <span class="special">=</span> <span class="identifier">foldl1</span><span class="special">&lt;</span><span class="identifier">int_token</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;,</span> <span class="identifier">sum_op</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"11 13 3 21"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">48</span><span class="special">,</span>
<span class="string">"ints should sum the numbers"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">""</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"when no numbers are provided, it should be an error"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.foldl_reject_incomplete"></a><a name="foldl_reject_incomplete"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl_reject_incomplete" title="foldl_reject_incomplete">foldl_reject_incomplete</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.foldl_reject_incomplete.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl_reject_incomplete.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl_reject_incomplete.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">State</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">ForwardOp</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">foldl_reject_incomplete</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.foldl_reject_incomplete.arguments"></a><p class="title"><b>Table 24.21. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">State</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">ForwardOp</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metafunction_class">template metafunction class</a>
taking two arguments
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.foldl_reject_incomplete.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl_reject_incomplete.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl_reject_incomplete.description">Description</a>
</h2>
<p>
The same as <a class="link" href="reference.html#foldl"><code class="computeroutput"><span class="identifier">foldl</span></code></a>,
but once <code class="computeroutput"><span class="identifier">P</span></code> rejects the
input, <code class="computeroutput"><span class="identifier">foldl_reject_incomplete</span></code>
checks if <code class="computeroutput"><span class="identifier">P</span></code> consumes any
characters before rejecting the input. If so, <code class="computeroutput"><span class="identifier">foldl_reject_incomplete</span></code>
rejects the input with the same error message this last application of
<code class="computeroutput"><span class="identifier">P</span></code> returned. Otherwise
<code class="computeroutput"><span class="identifier">foldl_reject_incomplete</span></code>
accepts the input and gives the same result as <a class="link" href="reference.html#foldl"><code class="computeroutput"><span class="identifier">foldl</span></code></a>.
</p>
<p>
Here is a diagram showing how <code class="computeroutput"><span class="identifier">foldl_reject_incomplete</span></code>
works by example:
</p>
<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'+'</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_int</span> <span class="special">=</span> <span class="identifier">last_of</span><span class="special">&lt;</span><span class="identifier">plus_token</span><span class="special">,</span> <span class="identifier">int_token</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">sum_op</span> <span class="special">=</span> <span class="identifier">mpl</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">&lt;</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">plus</span><span class="special">&lt;</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_1</span><span class="special">,</span> <span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_2</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">;</span>
</pre>
<p>
<span class="inlinemediaobject"><img src="../images/metaparse/foldl_reject_incomplete_diag1.png" width="70%"></span>
</p>
<h2>
<a name="metaparse.reference.alphabetical.foldl_reject_incomplete.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl_reject_incomplete.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl_reject_incomplete.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">foldl_reject_incomplete</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.foldl_reject_incomplete.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl_reject_incomplete.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl_reject_incomplete.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser, <code class="computeroutput"><span class="identifier">t</span></code> class, <code class="computeroutput"><span class="identifier">f</span></code>
metafunction class taking two arguments, <code class="computeroutput"><span class="identifier">s</span></code>
compile-time string and <code class="computeroutput"><span class="identifier">pos</span></code>
source position
</p>
<pre class="programlisting"><span class="identifier">foldl_reject_incomplete</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">t</span><span class="special">,</span> <span class="identifier">f</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<p>
is equivalent to
</p>
<pre class="programlisting"><span class="identifier">first_of</span><span class="special">&lt;</span><span class="identifier">foldl</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">t</span><span class="special">,</span> <span class="identifier">f</span><span class="special">&gt;,</span> <span class="identifier">fail_at_first_char_expected</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">&gt;</span> <span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.foldl_reject_incomplete.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl_reject_incomplete.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl_reject_incomplete.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">foldl_reject_incomplete</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">last_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">token</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">lambda</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">plus</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="keyword">int</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'+'</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_int</span> <span class="special">=</span> <span class="identifier">last_of</span><span class="special">&lt;</span><span class="identifier">plus_token</span><span class="special">,</span> <span class="identifier">int_token</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">sum_op</span> <span class="special">=</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">plus</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_1</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_2</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">ints</span> <span class="special">=</span> <span class="identifier">foldl_reject_incomplete</span><span class="special">&lt;</span><span class="identifier">plus_int</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">11</span><span class="special">&gt;,</span> <span class="identifier">sum_op</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"+ 13 + 3 + 21"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">48</span><span class="special">,</span>
<span class="string">"ints should sum the numbers"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"+ 13 + 3 +"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"when the last number is missing, it should be an error"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.foldl_reject_incomplete1"></a><a name="foldl_reject_incomplete1"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl_reject_incomplete1" title="foldl_reject_incomplete1">foldl_reject_incomplete1</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.foldl_reject_incomplete1.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl_reject_incomplete1.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl_reject_incomplete1.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">State</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">ForwardOp</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">foldl_reject_incomplete1</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.foldl_reject_incomplete1.arguments"></a><p class="title"><b>Table 24.22. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">State</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">ForwardOp</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metafunction_class">template metafunction class</a>
taking two arguments
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.foldl_reject_incomplete1.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl_reject_incomplete1.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl_reject_incomplete1.description">Description</a>
</h2>
<p>
The same as <a class="link" href="reference.html#foldl1"><code class="computeroutput"><span class="identifier">foldl1</span></code></a>,
but once <code class="computeroutput"><span class="identifier">P</span></code> rejects the
input, <code class="computeroutput"><span class="identifier">foldl_reject_incomplete1</span></code>
checks if <code class="computeroutput"><span class="identifier">P</span></code> consumes any
characters before rejecting the input. If so, <code class="computeroutput"><span class="identifier">foldl_reject_incomplete1</span></code>
rejects the input with the same error message this last application of
<code class="computeroutput"><span class="identifier">P</span></code> returned. Otherwise
<code class="computeroutput"><span class="identifier">foldl_reject_incomplete1</span></code>
accepts the input and gives the same result as <a class="link" href="reference.html#foldl1"><code class="computeroutput"><span class="identifier">foldl1</span></code></a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.foldl_reject_incomplete1.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl_reject_incomplete1.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl_reject_incomplete1.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">foldl_reject_incomplete1</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.foldl_reject_incomplete1.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl_reject_incomplete1.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl_reject_incomplete1.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser, <code class="computeroutput"><span class="identifier">t</span></code> class, <code class="computeroutput"><span class="identifier">f</span></code>
metafunction class taking two arguments, <code class="computeroutput"><span class="identifier">s</span></code>
compile-time string and <code class="computeroutput"><span class="identifier">pos</span></code>
source position
</p>
<pre class="programlisting"><span class="identifier">foldl_reject_incomplete1</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">t</span><span class="special">,</span> <span class="identifier">f</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<p>
is equivalent to
</p>
<pre class="programlisting"><span class="identifier">first_of</span><span class="special">&lt;</span><span class="identifier">foldl1</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">t</span><span class="special">,</span> <span class="identifier">f</span><span class="special">&gt;,</span> <span class="identifier">fail_at_first_char_expected</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">&gt;</span> <span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.foldl_reject_incomplete1.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl_reject_incomplete1.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl_reject_incomplete1.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">foldl_reject_incomplete1</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">last_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">token</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">lambda</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">plus</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="keyword">int</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'+'</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_int</span> <span class="special">=</span> <span class="identifier">last_of</span><span class="special">&lt;</span><span class="identifier">plus_token</span><span class="special">,</span> <span class="identifier">int_token</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">sum_op</span> <span class="special">=</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">plus</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_1</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_2</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">ints</span> <span class="special">=</span> <span class="identifier">foldl_reject_incomplete1</span><span class="special">&lt;</span><span class="identifier">plus_int</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">11</span><span class="special">&gt;,</span> <span class="identifier">sum_op</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"+ 13 + 3 + 21"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">48</span><span class="special">,</span>
<span class="string">"ints should sum the numbers"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"+ 13 + 3 +"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"when the last number is missing, it should be an error"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">""</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"when no numbers are provided, it should be an error"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.foldl_reject_incomplete_start_wi"></a><a name="foldl_reject_incomplete_start_with_parser"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl_reject_incomplete_start_wi" title="foldl_reject_incomplete_start_with_parser">foldl_reject_incomplete_start_with_parser</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.foldl_reject_incomplete_start_wi.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl_reject_incomplete_start_wi.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl_reject_incomplete_start_wi.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">StateP</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">ForwardOp</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">foldl_reject_incomplete_start_with_parser</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.foldl_reject_incomplete_start_wi.arguments"></a><p class="title"><b>Table 24.23. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">StateP</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">ForwardOp</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metafunction_class">template metafunction class</a>
taking two arguments
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.foldl_reject_incomplete_start_wi.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl_reject_incomplete_start_wi.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl_reject_incomplete_start_wi.description">Description</a>
</h2>
<p>
The same as <a class="link" href="reference.html#foldl_start_with_parser"><code class="computeroutput"><span class="identifier">foldl_start_with_parser</span></code></a>,
but once <code class="computeroutput"><span class="identifier">P</span></code> rejects the
input, <code class="computeroutput"><span class="identifier">foldl_reject_incomplete_start_with_parser</span></code>
checks if <code class="computeroutput"><span class="identifier">P</span></code> consumes any
characters before rejecting the input. If so, <code class="computeroutput"><span class="identifier">foldl_reject_incomplete_start_with_parser</span></code>
rejects the input with the same error message this last application of
<code class="computeroutput"><span class="identifier">P</span></code> returned. Otherwise
<code class="computeroutput"><span class="identifier">foldl_reject_incomplete_start_with_parser</span></code>
accepts the input and gives the same result as <a class="link" href="reference.html#foldl_start_with_parser"><code class="computeroutput"><span class="identifier">foldl_start_with_parser</span></code></a>.
</p>
<p>
Here is a diagram showing how <code class="computeroutput"><span class="identifier">foldl_reject_incomplete_start_with_parser</span></code>
works by example:
</p>
<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'+'</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_int</span> <span class="special">=</span> <span class="identifier">last_of</span><span class="special">&lt;</span><span class="identifier">plus_token</span><span class="special">,</span> <span class="identifier">int_token</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">sum_op</span> <span class="special">=</span> <span class="identifier">mpl</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">&lt;</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">plus</span><span class="special">&lt;</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_1</span><span class="special">,</span> <span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_2</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">;</span>
</pre>
<p>
<span class="inlinemediaobject"><img src="../images/metaparse/foldl_reject_incomplete_start_with_parser_diag1.png" width="70%"></span>
</p>
<p>
Further details can be found in the <a class="link" href="user_manual.html#introducing-foldl_reject_incomplete_start_with_parser">Introducing
foldl_reject_incomplete_start_with_parser</a> section of the <a class="link" href="user_manual.html#manual">User
Manual</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.foldl_reject_incomplete_start_wi.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl_reject_incomplete_start_wi.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl_reject_incomplete_start_wi.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">foldl_reject_incomplete_start_with_parser</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.foldl_reject_incomplete_start_wi.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl_reject_incomplete_start_wi.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl_reject_incomplete_start_wi.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser, <code class="computeroutput"><span class="identifier">pt</span></code> class, <code class="computeroutput"><span class="identifier">f</span></code>
metafunction class taking two arguments, <code class="computeroutput"><span class="identifier">s</span></code>
compile-time string and <code class="computeroutput"><span class="identifier">pos</span></code>
source position
</p>
<pre class="programlisting"><span class="identifier">foldl_reject_incomplete_start_with_parser</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">pt</span><span class="special">,</span> <span class="identifier">f</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<p>
is equivalent to
</p>
<pre class="programlisting"><span class="identifier">first_of</span><span class="special">&lt;</span>
<span class="identifier">foldl_start_with_parser</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">pt</span><span class="special">,</span> <span class="identifier">f</span><span class="special">&gt;,</span>
<span class="identifier">fail_at_first_char_expected</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.foldl_reject_incomplete_start_wi.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl_reject_incomplete_start_wi.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl_reject_incomplete_start_wi.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">foldl_reject_incomplete_start_with_parser</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">last_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">token</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">lambda</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">plus</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'+'</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_int</span> <span class="special">=</span> <span class="identifier">last_of</span><span class="special">&lt;</span><span class="identifier">plus_token</span><span class="special">,</span> <span class="identifier">int_token</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">sum_op</span> <span class="special">=</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">plus</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_1</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_2</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">ints</span> <span class="special">=</span>
<span class="identifier">foldl_reject_incomplete_start_with_parser</span><span class="special">&lt;</span><span class="identifier">plus_int</span><span class="special">,</span> <span class="identifier">int_token</span><span class="special">,</span> <span class="identifier">sum_op</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"11 + 13 + 3 + 21"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">48</span><span class="special">,</span>
<span class="string">"ints should sum the numbers"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"11 + 13 + 3 +"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"when the last number is missing, it should be an error"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.foldl_start_with_parser"></a><a name="foldl_start_with_parser"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl_start_with_parser" title="foldl_start_with_parser">foldl_start_with_parser</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.foldl_start_with_parser.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl_start_with_parser.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl_start_with_parser.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">StateP</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">ForwardOp</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">foldl_start_with_parser</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.foldl_start_with_parser.arguments"></a><p class="title"><b>Table 24.24. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">StateP</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">ForwardOp</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metafunction_class">template metafunction class</a>
taking two arguments
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.foldl_start_with_parser.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl_start_with_parser.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl_start_with_parser.description">Description</a>
</h2>
<p>
The same as <a class="link" href="reference.html#foldl"><code class="computeroutput"><span class="identifier">foldl</span></code></a>,
but before folding it applies a parser, <code class="computeroutput"><span class="identifier">StateP</span></code>
on the input. If it fails, <code class="computeroutput"><span class="identifier">foldl_start_with_parser</span></code>
fails. If it succeeds, <code class="computeroutput"><span class="identifier">foldl_start_with_parser</span></code>
works as <code class="computeroutput"><span class="identifier">foldl</span></code> taking the
result of <code class="computeroutput"><span class="identifier">StateP</span></code> as the
initial state.
</p>
<p>
Here is a diagram showing how <code class="computeroutput"><span class="identifier">foldl_start_with_parser</span></code>
works by example:
</p>
<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'+'</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_int</span> <span class="special">=</span> <span class="identifier">last_of</span><span class="special">&lt;</span><span class="identifier">plus_token</span><span class="special">,</span> <span class="identifier">int_token</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">sum_op</span> <span class="special">=</span> <span class="identifier">mpl</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">&lt;</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">plus</span><span class="special">&lt;</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_1</span><span class="special">,</span> <span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_2</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">;</span>
</pre>
<p>
<span class="inlinemediaobject"><img src="../images/metaparse/foldl_start_with_parser_diag1.png" width="70%"></span>
</p>
<p>
Further details can be found in the <a class="link" href="user_manual.html#introducing-foldl_start_with_parser">Introducing
foldl_start_with_parser</a> section of the <a class="link" href="user_manual.html#manual">User
Manual</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.foldl_start_with_parser.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl_start_with_parser.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl_start_with_parser.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">foldl_start_with_parser</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.foldl_start_with_parser.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl_start_with_parser.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl_start_with_parser.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser, <code class="computeroutput"><span class="identifier">pt</span></code> class, <code class="computeroutput"><span class="identifier">f</span></code>
metafunction class taking two arguments, <code class="computeroutput"><span class="identifier">s</span></code>
compile-time string and <code class="computeroutput"><span class="identifier">pos</span></code>
source position
</p>
<pre class="programlisting"><span class="identifier">foldl_start_with_parser</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">pt</span><span class="special">,</span> <span class="identifier">f</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<p>
is equivalent to
</p>
<pre class="programlisting"><span class="identifier">pt</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<p>
when the above expression returns a parsing error. It is
</p>
<pre class="programlisting"><span class="identifier">foldl</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">pt</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">,</span> <span class="identifier">f</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span>
<span class="identifier">get_remaining</span><span class="special">&lt;</span><span class="identifier">pt</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="identifier">get_position</span><span class="special">&lt;</span><span class="identifier">pt</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;</span>
</pre>
<p>
otherwise.
</p>
<h2>
<a name="metaparse.reference.alphabetical.foldl_start_with_parser.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl_start_with_parser.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl_start_with_parser.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">foldl_start_with_parser</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">last_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">token</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">lambda</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">plus</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'+'</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_int</span> <span class="special">=</span> <span class="identifier">last_of</span><span class="special">&lt;</span><span class="identifier">plus_token</span><span class="special">,</span> <span class="identifier">int_token</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">sum_op</span> <span class="special">=</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">plus</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_1</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_2</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">ints</span> <span class="special">=</span> <span class="identifier">foldl_start_with_parser</span><span class="special">&lt;</span><span class="identifier">plus_int</span><span class="special">,</span> <span class="identifier">int_token</span><span class="special">,</span> <span class="identifier">sum_op</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"11 + 13 + 3 + 21"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">48</span><span class="special">,</span>
<span class="string">"ints should sum the numbers"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">""</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"when no numbers are provided, it should be an error"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.foldl"></a><a name="foldl"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl" title="foldl">foldl</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.foldl.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">State</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">ForwardOp</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">foldl</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.foldl.arguments"></a><p class="title"><b>Table 24.25. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">State</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">ForwardOp</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metafunction_class">template metafunction class</a>
taking two arguments
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.foldl.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl.description">Description</a>
</h2>
<p>
<code class="computeroutput"><span class="identifier">foldl</span></code> applies <code class="computeroutput"><span class="identifier">P</span></code> on the input string repeatedly as long
as <code class="computeroutput"><span class="identifier">P</span></code> accepts the input.
The result of parsing is equivalent to <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">fold</span><span class="special">&lt;</span><span class="identifier">Sequence</span><span class="special">,</span> <span class="identifier">State</span><span class="special">,</span> <span class="identifier">ForwardOp</span><span class="special">&gt;</span></code>, where <code class="computeroutput"><span class="identifier">Sequence</span></code>
is the sequence of the results of the applications of <code class="computeroutput"><span class="identifier">P</span></code>.
</p>
<p>
When <code class="computeroutput"><span class="identifier">P</span></code> rejects the input
for the first time, <code class="computeroutput"><span class="identifier">foldl</span></code>
still accepts the input and the result of parsing is <code class="computeroutput"><span class="identifier">State</span></code>.
</p>
<p>
Here is a diagram showing how <code class="computeroutput"><span class="identifier">foldl</span></code>
works by example:
</p>
<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">sum_op</span> <span class="special">=</span> <span class="identifier">mpl</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">&lt;</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">plus</span><span class="special">&lt;</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_1</span><span class="special">,</span> <span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_2</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">;</span>
</pre>
<p>
<span class="inlinemediaobject"><img src="../images/metaparse/foldl_diag2.png" width="70%"></span>
</p>
<p>
Further details can be found in the <a class="link" href="user_manual.html#introducing-foldl">Introducing
foldl</a> section of the <a class="link" href="user_manual.html#manual">User Manual</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.foldl.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">foldl</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.foldl.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser, <code class="computeroutput"><span class="identifier">t</span></code> class, <code class="computeroutput"><span class="identifier">f</span></code>
metafunction class taking two arguments, <code class="computeroutput"><span class="identifier">s</span></code>
compile-time string and <code class="computeroutput"><span class="identifier">pos</span></code>
source position
</p>
<pre class="programlisting"><span class="identifier">foldl</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">t</span><span class="special">,</span> <span class="identifier">f</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<p>
is equivalent to
</p>
<pre class="programlisting"><span class="identifier">return_</span><span class="special">&lt;</span><span class="identifier">t</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<p>
when <code class="computeroutput"><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span></code> returns an error. It is
</p>
<pre class="programlisting"><span class="identifier">foldl</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">f</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">t</span><span class="special">,</span> <span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span> <span class="identifier">f</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span>
<span class="identifier">get_remaining</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;,</span>
<span class="identifier">get_position</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;</span>
<span class="special">&gt;</span>
</pre>
<p>
otherwise.
</p>
<h2>
<a name="metaparse.reference.alphabetical.foldl.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldl.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldl.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">foldl</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">token</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">lambda</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">plus</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">sum_op</span> <span class="special">=</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">plus</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_1</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_2</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">ints</span> <span class="special">=</span> <span class="identifier">foldl</span><span class="special">&lt;</span><span class="identifier">int_token</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;,</span> <span class="identifier">sum_op</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"11 13 3 21"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">48</span><span class="special">,</span>
<span class="string">"ints should sum the numbers"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">""</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">0</span><span class="special">,</span>
<span class="string">"the sum of no elements is 0"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.foldr1"></a><a name="foldr1"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr1" title="foldr1">foldr1</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.foldr1.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldr1.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr1.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">State</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">BackwardOp</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">foldr1</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.foldr1.arguments"></a><p class="title"><b>Table 24.26. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">State</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">BackwardOp</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metafunction_class">template metafunction class</a>
taking two arguments
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.foldr1.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldr1.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr1.description">Description</a>
</h2>
<p>
<code class="computeroutput"><span class="identifier">foldr1</span></code> applies <code class="computeroutput"><span class="identifier">P</span></code> on the input string repeatedly as long
as <code class="computeroutput"><span class="identifier">P</span></code> accepts the input.
The result of parsing is equivalent to <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">reverse_fold</span><span class="special">&lt;</span><span class="identifier">Sequence</span><span class="special">,</span> <span class="identifier">State</span><span class="special">,</span> <span class="identifier">BackwardOp</span><span class="special">&gt;</span></code>, where <code class="computeroutput"><span class="identifier">Sequence</span></code>
is the sequence of the results of the applications of <code class="computeroutput"><span class="identifier">P</span></code>.
</p>
<p>
When <code class="computeroutput"><span class="identifier">P</span></code> rejects the input
for the first time, <code class="computeroutput"><span class="identifier">foldr1</span></code>
rejects it as well. At least one successful application of <code class="computeroutput"><span class="identifier">P</span></code> is required for <code class="computeroutput"><span class="identifier">foldr1</span></code>
to accept the input.
</p>
<h2>
<a name="metaparse.reference.alphabetical.foldr1.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldr1.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr1.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">foldr1</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.foldr1.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldr1.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr1.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser, <code class="computeroutput"><span class="identifier">t</span></code> class, <code class="computeroutput"><span class="identifier">f</span></code>
metafunction class taking two arguments the following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">foldr1</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">t</span><span class="special">,</span> <span class="identifier">f</span><span class="special">&gt;</span>
<span class="identifier">last_of</span><span class="special">&lt;</span><span class="identifier">look_ahead</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">&gt;,</span> <span class="identifier">foldr</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">t</span><span class="special">,</span> <span class="identifier">f</span><span class="special">&gt;&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.foldr1.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldr1.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr1.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">foldr1</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">token</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">lambda</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">plus</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">sum_op</span> <span class="special">=</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">plus</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_1</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_2</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">ints</span> <span class="special">=</span> <span class="identifier">foldr1</span><span class="special">&lt;</span><span class="identifier">int_token</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;,</span> <span class="identifier">sum_op</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"11 13 3 21"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">48</span><span class="special">,</span>
<span class="string">"ints should sum the numbers"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">""</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"when no numbers are provided, it should be an error"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.foldr_reject_incomplete"></a><a name="foldr_reject_incomplete"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr_reject_incomplete" title="foldr_reject_incomplete">foldr_reject_incomplete</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.foldr_reject_incomplete.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldr_reject_incomplete.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr_reject_incomplete.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">State</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">BackwardOp</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">foldr_reject_incomplete</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.foldr_reject_incomplete.arguments"></a><p class="title"><b>Table 24.27. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">State</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">BackwardOp</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metafunction_class">template metafunction class</a>
taking two arguments
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.foldr_reject_incomplete.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldr_reject_incomplete.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr_reject_incomplete.description">Description</a>
</h2>
<p>
The same as <a class="link" href="reference.html#foldr"><code class="computeroutput"><span class="identifier">foldr</span></code></a>,
but once <code class="computeroutput"><span class="identifier">P</span></code> rejects the
input, <code class="computeroutput"><span class="identifier">foldr_reject_incomplete</span></code>
checks if <code class="computeroutput"><span class="identifier">P</span></code> consumes any
characters before rejecting the input. If so, <code class="computeroutput"><span class="identifier">foldr_reject_incomplete</span></code>
rejects the input with the same error message this last application of
<code class="computeroutput"><span class="identifier">P</span></code> returned. Otherwise
<code class="computeroutput"><span class="identifier">foldr_reject_incomplete</span></code>
accepts the input and gives the same result as <a class="link" href="reference.html#foldr"><code class="computeroutput"><span class="identifier">foldr</span></code></a>.
</p>
<p>
Here is a diagram showing how <code class="computeroutput"><span class="identifier">foldr_reject_incomplete</span></code>
works by example:
</p>
<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'+'</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_int</span> <span class="special">=</span> <span class="identifier">last_of</span><span class="special">&lt;</span><span class="identifier">plus_token</span><span class="special">,</span> <span class="identifier">int_token</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">sum_op</span> <span class="special">=</span> <span class="identifier">mpl</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">&lt;</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">plus</span><span class="special">&lt;</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_1</span><span class="special">,</span> <span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_2</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">;</span>
</pre>
<p>
<span class="inlinemediaobject"><img src="../images/metaparse/foldr_reject_incomplete_diag1.png" width="70%"></span>
</p>
<p>
Note that <code class="computeroutput"><span class="identifier">foldr_reject_incomplete</span></code>
folds from right to left and therefore does not start folding until it
reaches the end of the sequence. Since at the end of the sequence it finds
an error, folding does not happen at all.
</p>
<h2>
<a name="metaparse.reference.alphabetical.foldr_reject_incomplete.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldr_reject_incomplete.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr_reject_incomplete.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">foldr_reject_incomplete</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.foldr_reject_incomplete.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldr_reject_incomplete.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr_reject_incomplete.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser, <code class="computeroutput"><span class="identifier">t</span></code> class, <code class="computeroutput"><span class="identifier">f</span></code>
metafunction class taking two arguments, <code class="computeroutput"><span class="identifier">s</span></code>
compile-time string and <code class="computeroutput"><span class="identifier">pos</span></code>
source position
</p>
<pre class="programlisting"><span class="identifier">foldr_reject_incomplete</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">t</span><span class="special">,</span> <span class="identifier">f</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<p>
is equivalent to
</p>
<pre class="programlisting"><span class="identifier">first_of</span><span class="special">&lt;</span><span class="identifier">foldr</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">t</span><span class="special">,</span> <span class="identifier">f</span><span class="special">&gt;,</span> <span class="identifier">fail_at_first_char_expected</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">&gt;</span> <span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.foldr_reject_incomplete.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldr_reject_incomplete.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr_reject_incomplete.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">foldr_reject_incomplete</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">last_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">token</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">lambda</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">plus</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="keyword">int</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'+'</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_int</span> <span class="special">=</span> <span class="identifier">last_of</span><span class="special">&lt;</span><span class="identifier">plus_token</span><span class="special">,</span> <span class="identifier">int_token</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">sum_op</span> <span class="special">=</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">plus</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_1</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_2</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">ints</span> <span class="special">=</span> <span class="identifier">foldr_reject_incomplete</span><span class="special">&lt;</span><span class="identifier">plus_int</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">11</span><span class="special">&gt;,</span> <span class="identifier">sum_op</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"+ 13 + 3 + 21"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">48</span><span class="special">,</span>
<span class="string">"ints should sum the numbers"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"+ 13 + 3 +"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"when the last number is missing, it should be an error"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.foldr_reject_incomplete1"></a><a name="foldr_reject_incomplete1"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr_reject_incomplete1" title="foldr_reject_incomplete1">foldr_reject_incomplete1</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.foldr_reject_incomplete1.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldr_reject_incomplete1.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr_reject_incomplete1.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">State</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">BackwardOp</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">foldr_reject_incomplete1</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.foldr_reject_incomplete1.arguments"></a><p class="title"><b>Table 24.28. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">State</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">BackwardOp</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metafunction_class">template metafunction class</a>
taking two arguments
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.foldr_reject_incomplete1.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldr_reject_incomplete1.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr_reject_incomplete1.description">Description</a>
</h2>
<p>
The same as <a class="link" href="reference.html#foldr1"><code class="computeroutput"><span class="identifier">foldr1</span></code></a>,
but once <code class="computeroutput"><span class="identifier">P</span></code> rejects the
input, <code class="computeroutput"><span class="identifier">foldr_reject_incomplete1</span></code>
checks if <code class="computeroutput"><span class="identifier">P</span></code> consumes any
characters before rejecting the input. If so, <code class="computeroutput"><span class="identifier">foldr_reject_incomplete1</span></code>
rejects the input with the same error message this last application of
<code class="computeroutput"><span class="identifier">P</span></code> returned. Otherwise
<code class="computeroutput"><span class="identifier">foldr_reject_incomplete1</span></code>
accepts the input and gives the same result as <a class="link" href="reference.html#foldr1"><code class="computeroutput"><span class="identifier">foldr1</span></code></a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.foldr_reject_incomplete1.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldr_reject_incomplete1.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr_reject_incomplete1.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">foldr_reject_incomplete1</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.foldr_reject_incomplete1.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldr_reject_incomplete1.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr_reject_incomplete1.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser, <code class="computeroutput"><span class="identifier">t</span></code> class, <code class="computeroutput"><span class="identifier">f</span></code>
metafunction class taking two arguments, <code class="computeroutput"><span class="identifier">s</span></code>
compile-time string and <code class="computeroutput"><span class="identifier">pos</span></code>
source position
</p>
<pre class="programlisting"><span class="identifier">foldr_reject_incomplete1</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">t</span><span class="special">,</span> <span class="identifier">f</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<p>
is equivalent to
</p>
<pre class="programlisting"><span class="identifier">first_of</span><span class="special">&lt;</span><span class="identifier">foldr1</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">t</span><span class="special">,</span> <span class="identifier">f</span><span class="special">&gt;,</span> <span class="identifier">fail_at_first_char_expected</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">&gt;</span> <span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.foldr_reject_incomplete1.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldr_reject_incomplete1.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr_reject_incomplete1.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">foldr_reject_incomplete1</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">last_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">token</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">lambda</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">plus</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="keyword">int</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'+'</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_int</span> <span class="special">=</span> <span class="identifier">last_of</span><span class="special">&lt;</span><span class="identifier">plus_token</span><span class="special">,</span> <span class="identifier">int_token</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">sum_op</span> <span class="special">=</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">plus</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_1</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_2</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">ints</span> <span class="special">=</span> <span class="identifier">foldr_reject_incomplete1</span><span class="special">&lt;</span><span class="identifier">plus_int</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">11</span><span class="special">&gt;,</span> <span class="identifier">sum_op</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"+ 13 + 3 + 21"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">48</span><span class="special">,</span>
<span class="string">"ints should sum the numbers"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"+ 13 + 3 +"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"when the last number is missing, it should be an error"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">""</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"when no numbers are provided, it should be an error"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.foldr_start_with_parser"></a><a name="foldr_start_with_parser"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr_start_with_parser" title="foldr_start_with_parser">foldr_start_with_parser</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.foldr_start_with_parser.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldr_start_with_parser.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr_start_with_parser.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">StateP</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">BackwardOp</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">foldr_start_with_parser</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.foldr_start_with_parser.arguments"></a><p class="title"><b>Table 24.29. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">StateP</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">BackwardOp</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metafunction_class">template metafunction class</a>
taking two arguments
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.foldr_start_with_parser.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldr_start_with_parser.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr_start_with_parser.description">Description</a>
</h2>
<p>
The same as <a class="link" href="reference.html#foldr"><code class="computeroutput"><span class="identifier">foldr</span></code></a>,
but after folding it applies a parser, <code class="computeroutput"><span class="identifier">StateP</span></code>
on the input. If <code class="computeroutput"><span class="identifier">StateP</span></code>
fails, <code class="computeroutput"><span class="identifier">foldr_start_with_parser</span></code>
fails. If it succeeds, the result of parsing is equivalent to <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">reverse_fold</span><span class="special">&lt;</span><span class="identifier">Sequence</span><span class="special">,</span> <span class="identifier">State</span><span class="special">,</span> <span class="identifier">BackwardOp</span><span class="special">&gt;</span></code>,
where <code class="computeroutput"><span class="identifier">Sequence</span></code> is the sequence
of the results of the applications of <code class="computeroutput"><span class="identifier">P</span></code>
and <code class="computeroutput"><span class="identifier">State</span></code> is the result
<code class="computeroutput"><span class="identifier">StateP</span></code> returned <span class="emphasis"><em>after</em></span>
the repeated application of <code class="computeroutput"><span class="identifier">P</span></code>
on the input.
</p>
<p>
Here is a diagram showing how <code class="computeroutput"><span class="identifier">foldr_start_with_parser</span></code>
works by example:
</p>
<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'+'</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">int_plus</span> <span class="special">=</span> <span class="identifier">first_of</span><span class="special">&lt;</span><span class="identifier">int_token</span><span class="special">,</span> <span class="identifier">plus_token</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">sum_op</span> <span class="special">=</span> <span class="identifier">mpl</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">&lt;</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">plus</span><span class="special">&lt;</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_1</span><span class="special">,</span> <span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_2</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">;</span>
</pre>
<p>
<span class="inlinemediaobject"><img src="../images/metaparse/foldr_start_with_parser_diag1.png" width="70%"></span>
</p>
<p>
Further details can be found in the <a class="link" href="user_manual.html#introducing-foldr_start_with_parser">Introducing
foldr_start_with_parser</a> section of the <a class="link" href="user_manual.html#manual">User
Manual</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.foldr_start_with_parser.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldr_start_with_parser.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr_start_with_parser.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">foldr_start_with_parser</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.foldr_start_with_parser.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldr_start_with_parser.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr_start_with_parser.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser, <code class="computeroutput"><span class="identifier">pt</span></code> class, <code class="computeroutput"><span class="identifier">f</span></code>
metafunction class taking two arguments, <code class="computeroutput"><span class="identifier">s</span></code>
compile-time string and <code class="computeroutput"><span class="identifier">pos</span></code>
source position let <code class="computeroutput"><span class="identifier">pos_</span></code>
be the position where the repeated application of <code class="computeroutput"><span class="identifier">p</span></code>
on <code class="computeroutput"><span class="identifier">s</span></code> fails for the first
time. Let <code class="computeroutput"><span class="identifier">s_</span></code> be the postfix
of <code class="computeroutput"><span class="identifier">s</span></code> starting at that position.
</p>
<pre class="programlisting"><span class="identifier">foldr_start_with_parser</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">pt</span><span class="special">,</span> <span class="identifier">f</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<p>
is equivalent to
</p>
<pre class="programlisting"><span class="identifier">pt</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s_</span><span class="special">,</span> <span class="identifier">pos_</span><span class="special">&gt;</span>
</pre>
<p>
when the above expression returns a parsing error. It is
</p>
<pre class="programlisting"><span class="identifier">return_</span><span class="special">&lt;</span>
<span class="identifier">foldr</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">pt</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s_</span><span class="special">,</span> <span class="identifier">pos_</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">,</span> <span class="identifier">f</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span>
<span class="identifier">get_remaining</span><span class="special">&lt;</span><span class="identifier">pt</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s_</span><span class="special">,</span> <span class="identifier">pos_</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="identifier">get_position</span><span class="special">&lt;</span><span class="identifier">pt</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s_</span><span class="special">,</span> <span class="identifier">pos_</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;</span>
</pre>
<p>
otherwise.
</p>
<h2>
<a name="metaparse.reference.alphabetical.foldr_start_with_parser.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldr_start_with_parser.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr_start_with_parser.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">foldr_start_with_parser</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">first_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">token</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">lambda</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">plus</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'+'</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">int_plus</span> <span class="special">=</span> <span class="identifier">first_of</span><span class="special">&lt;</span><span class="identifier">int_token</span><span class="special">,</span> <span class="identifier">plus_token</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">sum_op</span> <span class="special">=</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">plus</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_1</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_2</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">ints</span> <span class="special">=</span> <span class="identifier">foldr_start_with_parser</span><span class="special">&lt;</span><span class="identifier">int_plus</span><span class="special">,</span> <span class="identifier">int_token</span><span class="special">,</span> <span class="identifier">sum_op</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"11 + 13 + 3 + 21"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">48</span><span class="special">,</span>
<span class="string">"ints should sum the numbers"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">""</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"when no numbers are provided, it should be an error"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.foldr"></a><a name="foldr"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr" title="foldr">foldr</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.foldr.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldr.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">State</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">BackwardOp</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">foldr</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.foldr.arguments"></a><p class="title"><b>Table 24.30. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">State</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">BackwardOp</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metafunction_class">template metafunction class</a>
taking two arguments
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.foldr.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldr.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr.description">Description</a>
</h2>
<p>
<code class="computeroutput"><span class="identifier">foldr</span></code> applies <code class="computeroutput"><span class="identifier">P</span></code> on the input string repeatedly as long
as <code class="computeroutput"><span class="identifier">P</span></code> accepts the input.
The result of parsing is equivalent to <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">reverse_fold</span><span class="special">&lt;</span><span class="identifier">Sequence</span><span class="special">,</span> <span class="identifier">State</span><span class="special">,</span> <span class="identifier">BackwardOp</span><span class="special">&gt;</span></code>, where <code class="computeroutput"><span class="identifier">Sequence</span></code>
is the sequence of the results of the applications of <code class="computeroutput"><span class="identifier">P</span></code>.
</p>
<p>
When <code class="computeroutput"><span class="identifier">P</span></code> rejects the input
for the first time, <code class="computeroutput"><span class="identifier">foldr</span></code>
still accepts the input and the result of parsing is <code class="computeroutput"><span class="identifier">State</span></code>.
</p>
<p>
Here is a diagram showing how <code class="computeroutput"><span class="identifier">foldr</span></code>
works by example:
</p>
<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">sum_op</span> <span class="special">=</span> <span class="identifier">mpl</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">&lt;</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">plus</span><span class="special">&lt;</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_1</span><span class="special">,</span> <span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_2</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">;</span>
</pre>
<p>
<span class="inlinemediaobject"><img src="../images/metaparse/foldr_diag1.png" width="70%"></span>
</p>
<p>
Further details can be found in the <a class="link" href="user_manual.html#introducing-foldr">Introducing
foldr</a> section of the <a class="link" href="user_manual.html#manual">User Manual</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.foldr.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldr.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">foldr</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.foldr.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldr.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser, <code class="computeroutput"><span class="identifier">t</span></code> class, <code class="computeroutput"><span class="identifier">f</span></code>
metafunction class taking two arguments, <code class="computeroutput"><span class="identifier">s</span></code>
compile-time string and <code class="computeroutput"><span class="identifier">pos</span></code>
source position
</p>
<pre class="programlisting"><span class="identifier">foldr</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">t</span><span class="special">,</span> <span class="identifier">f</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<p>
is equivalent to
</p>
<pre class="programlisting"><span class="identifier">return_</span><span class="special">&lt;</span><span class="identifier">t</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<p>
when <code class="computeroutput"><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span></code> returns an error. It is
</p>
<pre class="programlisting"><span class="identifier">f</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">foldr</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">t</span><span class="special">,</span> <span class="identifier">f</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span>
<span class="identifier">get_remaining</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;,</span>
<span class="identifier">get_position</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;</span>
<span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;</span>
</pre>
<p>
otherwise.
</p>
<h2>
<a name="metaparse.reference.alphabetical.foldr.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.foldr.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.foldr.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">foldr</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">token</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">lambda</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">plus</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">sum_op</span> <span class="special">=</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">plus</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_1</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_2</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">ints</span> <span class="special">=</span> <span class="identifier">foldr</span><span class="special">&lt;</span><span class="identifier">int_token</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;,</span> <span class="identifier">sum_op</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"11 13 3 21"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">48</span><span class="special">,</span>
<span class="string">"ints should sum the numbers"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">""</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">0</span><span class="special">,</span>
<span class="string">"the sum of no elements is 0"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.get_col"></a><a name="get_col"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.get_col" title="get_col">get_col</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.get_col.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_col.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_col.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">SourcePosition</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">get_col</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#lazy_metafunction">lazy template metafunction</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.get_col.arguments"></a><p class="title"><b>Table 24.31. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">SourcePosition</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#source_position">source position</a>
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.get_col.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_col.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_col.description">Description</a>
</h2>
<p>
Returns the column of a source position.
</p>
<h2>
<a name="metaparse.reference.alphabetical.get_col.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_col.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_col.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_col</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.get_col.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_col.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_col.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">l</span></code>, <code class="computeroutput"><span class="identifier">c</span></code> compile-time wrapped integral values
and <code class="computeroutput"><span class="identifier">ch</span></code> compile-time wrapped
character the following are equivalent
</p>
<pre class="programlisting"><span class="identifier">get_col</span><span class="special">&lt;</span><span class="identifier">source_position</span><span class="special">&lt;</span><span class="identifier">l</span><span class="special">,</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">ch</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="identifier">c</span><span class="special">::</span><span class="identifier">type</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.get_col.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_col.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_col.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_col</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">source_position</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">struct</span> <span class="identifier">returns_source_position</span>
<span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span>
<span class="identifier">source_position</span><span class="special">&lt;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">11</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="number">0</span><span class="special">&gt;</span>
<span class="special">&gt;;</span>
<span class="special">};</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_col</span><span class="special">&lt;</span>
<span class="identifier">source_position</span><span class="special">&lt;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">11</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="number">0</span><span class="special">&gt;</span>
<span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">13</span><span class="special">,</span>
<span class="string">"It should return the column of a source position"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_col</span><span class="special">&lt;</span><span class="identifier">returns_source_position</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">13</span><span class="special">,</span>
<span class="string">"It should support lazy evaluation"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.get_line"></a><a name="get_line"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.get_line" title="get_line">get_line</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.get_line.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_line.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_line.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">SourcePosition</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">get_line</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#lazy_metafunction">lazy template metafunction</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.get_line.arguments"></a><p class="title"><b>Table 24.32. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">SourcePosition</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#source_position">source position</a>
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.get_line.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_line.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_line.description">Description</a>
</h2>
<p>
Returns the line of a source position.
</p>
<h2>
<a name="metaparse.reference.alphabetical.get_line.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_line.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_line.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_line</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.get_line.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_line.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_line.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">l</span></code>, <code class="computeroutput"><span class="identifier">c</span></code> compile-time wrapped integral values
and <code class="computeroutput"><span class="identifier">ch</span></code> compile-time wrapped
character the following are equivalent
</p>
<pre class="programlisting"><span class="identifier">get_line</span><span class="special">&lt;</span><span class="identifier">source_position</span><span class="special">&lt;</span><span class="identifier">l</span><span class="special">,</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">ch</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="identifier">l</span><span class="special">::</span><span class="identifier">type</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.get_line.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_line.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_line.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_line</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">source_position</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">struct</span> <span class="identifier">returns_source_position</span>
<span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span>
<span class="identifier">source_position</span><span class="special">&lt;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">11</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="number">0</span><span class="special">&gt;</span>
<span class="special">&gt;;</span>
<span class="special">};</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_line</span><span class="special">&lt;</span>
<span class="identifier">source_position</span><span class="special">&lt;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">11</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="number">0</span><span class="special">&gt;</span>
<span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">11</span><span class="special">,</span>
<span class="string">"It should return the line of a source position"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_line</span><span class="special">&lt;</span><span class="identifier">returns_source_position</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">11</span><span class="special">,</span>
<span class="string">"It should support lazy evaluation"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.get_message"></a><a name="get_message"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.get_message" title="get_message">get_message</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.get_message.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_message.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_message.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">E</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">get_message</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#lazy_metafunction">lazy template metafunction</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.get_message.arguments"></a><p class="title"><b>Table 24.33. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">E</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#reject">reject</a> value
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.get_message.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_message.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_message.description">Description</a>
</h2>
<p>
Returns the error message of a parsing failure.
</p>
<h2>
<a name="metaparse.reference.alphabetical.get_message.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_message.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_message.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_message</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.get_message.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_message.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_message.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_message</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">reject</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">define_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="identifier">BOOST_METAPARSE_DEFINE_ERROR</span><span class="special">(</span><span class="identifier">sample_error</span><span class="special">,</span> <span class="string">"Sample error message"</span><span class="special">);</span>
<span class="keyword">struct</span> <span class="identifier">returns_reject</span>
<span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span> <span class="identifier">reject</span><span class="special">&lt;</span><span class="identifier">sample_error</span><span class="special">,</span> <span class="identifier">start</span><span class="special">&gt;;</span>
<span class="special">};</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
<span class="identifier">sample_error</span><span class="special">,</span>
<span class="identifier">get_message</span><span class="special">&lt;</span><span class="identifier">reject</span><span class="special">&lt;</span><span class="identifier">sample_error</span><span class="special">,</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"It should return the message"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span><span class="identifier">sample_error</span><span class="special">,</span> <span class="identifier">get_message</span><span class="special">&lt;</span><span class="identifier">returns_reject</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"It should support lazy evaluation"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.get_position"></a><a name="get_position"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.get_position" title="get_position">get_position</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.get_position.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_position.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_position.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">D</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">get_position</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#lazy_metafunction">lazy template metafunction</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.get_position.arguments"></a><p class="title"><b>Table 24.34. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">D</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#accept">accept</a> or <a class="link" href="reference.html#reject">reject</a>
value
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.get_position.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_position.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_position.description">Description</a>
</h2>
<p>
Returns the source position information of a parsing result.
</p>
<h2>
<a name="metaparse.reference.alphabetical.get_position.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_position.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_position.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_position</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.get_position.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_position.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_position.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_position</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">accept</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">reject</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">define_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="identifier">BOOST_METAPARSE_DEFINE_ERROR</span><span class="special">(</span><span class="identifier">sample_error</span><span class="special">,</span> <span class="string">"Sample error message"</span><span class="special">);</span>
<span class="keyword">struct</span> <span class="identifier">returns_reject</span>
<span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span> <span class="identifier">reject</span><span class="special">&lt;</span><span class="identifier">sample_error</span><span class="special">,</span> <span class="identifier">start</span><span class="special">&gt;;</span>
<span class="special">};</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
<span class="identifier">start</span><span class="special">,</span>
<span class="identifier">get_position</span><span class="special">&lt;</span><span class="identifier">reject</span><span class="special">&lt;</span><span class="identifier">sample_error</span><span class="special">,</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"It should return the position of a reject"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
<span class="identifier">start</span><span class="special">,</span>
<span class="identifier">get_position</span><span class="special">&lt;</span>
<span class="identifier">accept</span><span class="special">&lt;</span><span class="identifier">sample_error</span><span class="special">,</span> <span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"foo"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"It should return the position of an accept"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span><span class="identifier">start</span><span class="special">,</span> <span class="identifier">get_position</span><span class="special">&lt;</span><span class="identifier">returns_reject</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"It should support lazy evaluation"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.get_prev_char"></a><a name="get_prev_char"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.get_prev_char" title="get_prev_char">get_prev_char</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.get_prev_char.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_prev_char.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_prev_char.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">SourcePosition</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">get_prev_char</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#lazy_metafunction">lazy template metafunction</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.get_prev_char.arguments"></a><p class="title"><b>Table 24.35. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">SourcePosition</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#source_position">source position</a>
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.get_prev_char.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_prev_char.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_prev_char.description">Description</a>
</h2>
<p>
Returns the last character the source position was updated with. The value
it returns for <a class="link" href="reference.html#start"><code class="computeroutput"><span class="identifier">start</span></code></a>
is unspecified.
</p>
<h2>
<a name="metaparse.reference.alphabetical.get_prev_char.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_prev_char.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_prev_char.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_prev_char</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.get_prev_char.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_prev_char.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_prev_char.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">l</span></code>, <code class="computeroutput"><span class="identifier">c</span></code> compile-time wrapped integral values
and <code class="computeroutput"><span class="identifier">ch</span></code> compile-time wrapped
character the following are equivalent
</p>
<pre class="programlisting"><span class="identifier">get_prev_char</span><span class="special">&lt;</span><span class="identifier">source_position</span><span class="special">&lt;</span><span class="identifier">l</span><span class="special">,</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">ch</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="identifier">ch</span><span class="special">::</span><span class="identifier">type</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.get_prev_char.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_prev_char.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_prev_char.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_prev_char</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">source_position</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">struct</span> <span class="identifier">returns_source_position</span>
<span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span>
<span class="identifier">source_position</span><span class="special">&lt;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">11</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'x'</span><span class="special">&gt;</span>
<span class="special">&gt;;</span>
<span class="special">};</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_prev_char</span><span class="special">&lt;</span>
<span class="identifier">source_position</span><span class="special">&lt;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">11</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'x'</span><span class="special">&gt;</span>
<span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="char">'x'</span><span class="special">,</span>
<span class="string">"It should return the prev. char of a source position"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_prev_char</span><span class="special">&lt;</span><span class="identifier">returns_source_position</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="char">'x'</span><span class="special">,</span>
<span class="string">"It should support lazy evaluation"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.get_remaining"></a><a name="get_remaining"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.get_remaining" title="get_remaining">get_remaining</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.get_remaining.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_remaining.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_remaining.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">D</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">get_remaining</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#lazy_metafunction">lazy template metafunction</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.get_remaining.arguments"></a><p class="title"><b>Table 24.36. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">D</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#accept">accept</a> value
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.get_remaining.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_remaining.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_remaining.description">Description</a>
</h2>
<p>
Returns the remaining string information of a parsing result.
</p>
<h2>
<a name="metaparse.reference.alphabetical.get_remaining.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_remaining.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_remaining.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_remaining</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.get_remaining.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_remaining.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_remaining.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_remaining</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">accept</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">struct</span> <span class="identifier">returns_accept</span>
<span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span>
<span class="identifier">accept</span><span class="special">&lt;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;,</span>
<span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"foo"</span><span class="special">),</span>
<span class="identifier">start</span>
<span class="special">&gt;;</span>
<span class="special">};</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
<span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"foo"</span><span class="special">),</span>
<span class="identifier">get_remaining</span><span class="special">&lt;</span>
<span class="identifier">accept</span><span class="special">&lt;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;,</span>
<span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"foo"</span><span class="special">),</span>
<span class="identifier">start</span>
<span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"It should return the remaining input"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
<span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"foo"</span><span class="special">),</span>
<span class="identifier">get_remaining</span><span class="special">&lt;</span><span class="identifier">returns_accept</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"It should support lazy evaluation"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.get_result"></a><a name="get_result"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.get_result" title="get_result">get_result</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.get_result.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_result.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_result.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">D</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">get_result</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#lazy_metafunction">lazy template metafunction</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.get_result.arguments"></a><p class="title"><b>Table 24.37. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">D</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#accept">accept</a> value
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.get_result.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_result.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_result.description">Description</a>
</h2>
<p>
Returns the result information of a parsing result.
</p>
<h2>
<a name="metaparse.reference.alphabetical.get_result.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_result.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_result.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.get_result.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.get_result.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.get_result.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">accept</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">struct</span> <span class="identifier">returns_accept</span>
<span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span>
<span class="identifier">accept</span><span class="special">&lt;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;,</span>
<span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"foo"</span><span class="special">),</span>
<span class="identifier">start</span>
<span class="special">&gt;;</span>
<span class="special">};</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">accept</span><span class="special">&lt;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;,</span>
<span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"foo"</span><span class="special">),</span>
<span class="identifier">start</span>
<span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">13</span><span class="special">,</span>
<span class="string">"It should return the result of parsing"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">returns_accept</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">13</span><span class="special">,</span>
<span class="string">"It should support lazy evaluation"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.grammar"></a><a name="grammar"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.grammar" title="grammar">grammar</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.grammar.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.grammar.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.grammar.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">StartSymbol</span> <span class="special">=</span> <span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"S"</span><span class="special">)&gt;</span>
<span class="keyword">struct</span> <span class="identifier">grammar</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">S</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Pos</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">apply</span><span class="special">;</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Name</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">P</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">import</span><span class="special">;</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">S</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Action</span> <span class="special">=</span> <span class="comment">/* unspecified */</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">rule</span><span class="special">;</span>
<span class="special">};</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.grammar.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.grammar.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.grammar.description">Description</a>
</h2>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
Note that using this adds a significant overhead to your builds. When
someone uses your parser, the compiler will have to build your grammar
parser, use it to parse your grammar and build your parser and then it
can parse the input the user would like to parse with your parser. You
might consider using the parser combinators the library provides.
</p></td></tr>
</table></div>
<p>
Parser combinator for constructing parsers based on an embedded DSL similar
to EBNF. It can be used the following way:
</p>
<pre class="programlisting"><span class="identifier">grammar</span><span class="special">&lt;&gt;</span>
<span class="comment">// definitions</span>
</pre>
<p>
where a definition can be a rule or an import command.
</p>
<p>
Rules look like on of the following:
</p>
<pre class="programlisting"><span class="special">::</span><span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"name ::= def"</span><span class="special">)&gt;</span>
<span class="special">::</span><span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"name ::= def"</span><span class="special">),</span> <span class="identifier">semantic_action</span><span class="special">&gt;</span>
</pre>
<p>
<code class="computeroutput"><span class="identifier">name</span></code> consists of letters,
digits and the <code class="computeroutput"><span class="identifier">_</span></code> character.
It is the name of the symbol being defined. <code class="computeroutput"><span class="identifier">def</span></code>
describes the rule. It can be
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
the name of a symbol
</li>
<li class="listitem">
a terminal, which is a character between single quotes. <code class="computeroutput"><span class="special">\</span></code> can be used for escaping. The following
are accepted: <code class="computeroutput"><span class="special">\</span><span class="identifier">n</span></code>,
<code class="computeroutput"><span class="special">\</span><span class="identifier">r</span></code>,
<code class="computeroutput"><span class="special">\</span><span class="identifier">t</span></code>,
<code class="computeroutput"><span class="special">\\</span></code>, <code class="computeroutput"><span class="special">\</span><span class="error">'</span></code>
</li>
<li class="listitem">
a sequence of definitions
</li>
<li class="listitem">
a definition followed by the <code class="computeroutput"><span class="special">*</span></code>
character, which means repetition accepting 0 match
</li>
<li class="listitem">
a definition followed by the <code class="computeroutput"><span class="special">+</span></code>
character, which means repetition expecting at least one match
</li>
<li class="listitem">
a definition in brackets
</li>
</ul></div>
<p>
Rules take an optional <code class="computeroutput"><span class="identifier">semantic_action</span></code>
argument. It is a placeholder expression taking one argument. When this
is given, this is used to transform the result of the rule.
</p>
<p>
Imports can be used to turn an arbitrary parser into a symbol available
for the rules. Import definitions look like the following:
</p>
<pre class="programlisting"><span class="special">::</span><span class="identifier">import</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"name"</span><span class="special">),</span> <span class="identifier">parser</span><span class="special">&gt;</span>
</pre>
<p>
<code class="computeroutput"><span class="identifier">name</span></code> is the name of the
symbol, <code class="computeroutput"><span class="identifier">parser</span></code> is the parser
to bind the name to.
</p>
<p>
The start symbol of the grammar is specified by the template argument of
the <code class="computeroutput"><span class="identifier">grammar</span></code> template. This
is optional, the default value is <code class="computeroutput"><span class="identifier">S</span></code>.
</p>
<p>
Note that the current implementation "inlines" the referenced
symbols while parsing the grammar and recursion is not supported because
of this.
</p>
<h2>
<a name="metaparse.reference.alphabetical.grammar.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.grammar.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.grammar.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">grammar</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.grammar.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.grammar.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.grammar.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">BOOST_METAPARSE_LIMIT_STRING_SIZE</span> <span class="number">64</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">grammar</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">token</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">entire_input</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">build_parser</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">front</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">back</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">plus</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">fold</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">lambda</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">::</span><span class="identifier">token</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">::</span><span class="identifier">int_</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">::</span><span class="identifier">build_parser</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">::</span><span class="identifier">entire_input</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">::</span><span class="identifier">grammar</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">front</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">back</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">plus</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">fold</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_1</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_2</span><span class="special">;</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">B</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">lazy_plus</span> <span class="special">:</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">plus</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">A</span><span class="special">::</span><span class="identifier">type</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">B</span><span class="special">::</span><span class="identifier">type</span><span class="special">&gt;</span> <span class="special">{};</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Sequence</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">State</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">ForwardOp</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">lazy_fold</span> <span class="special">:</span>
<span class="identifier">fold</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Sequence</span><span class="special">::</span><span class="identifier">type</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">State</span><span class="special">::</span><span class="identifier">type</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">ForwardOp</span><span class="special">::</span><span class="identifier">type</span><span class="special">&gt;</span>
<span class="special">{};</span>
<span class="keyword">using</span> <span class="identifier">plus_action</span> <span class="special">=</span>
<span class="identifier">lazy_fold</span><span class="special">&lt;</span><span class="identifier">back</span><span class="special">&lt;</span><span class="identifier">_1</span><span class="special">&gt;,</span> <span class="identifier">front</span><span class="special">&lt;</span><span class="identifier">_1</span><span class="special">&gt;,</span> <span class="identifier">lambda</span><span class="special">&lt;</span><span class="identifier">lazy_plus</span><span class="special">&lt;</span><span class="identifier">_1</span><span class="special">,</span> <span class="identifier">back</span><span class="special">&lt;</span><span class="identifier">_2</span><span class="special">&gt;&gt;&gt;::</span><span class="identifier">type</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_grammar</span> <span class="special">=</span>
<span class="identifier">grammar</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"plus_exp"</span><span class="special">)&gt;</span>
<span class="special">::</span><span class="identifier">import</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"int_token"</span><span class="special">),</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="special">::</span><span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"ws ::= (' ' | '\n' | '\r' | '\t')*"</span><span class="special">)&gt;::</span><span class="identifier">type</span>
<span class="special">::</span><span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"plus_token ::= '+' ws"</span><span class="special">),</span> <span class="identifier">front</span><span class="special">&lt;</span><span class="identifier">_1</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="special">::</span><span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"plus_exp ::= int_token (plus_token int_token)*"</span><span class="special">),</span> <span class="identifier">plus_action</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">plus_parser</span> <span class="special">=</span> <span class="identifier">build_parser</span><span class="special">&lt;</span><span class="identifier">entire_input</span><span class="special">&lt;</span><span class="identifier">plus_grammar</span><span class="special">&gt;&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">plus_parser</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"1 + 2 + 3 + 4"</span><span class="special">)&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">10</span><span class="special">,</span>
<span class="string">"Arithmetic expression should be evaluated"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.if"></a><a name="if_"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.if" title="if_">if_</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.if.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.if.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.if.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">F</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">if_</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.if.arguments"></a><p class="title"><b>Table 24.38. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">T</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">F</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a>
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.if.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.if.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.if.description">Description</a>
</h2>
<p>
<code class="computeroutput"><span class="identifier">if_</span></code> always accepts the
input string. The result of parsing is <code class="computeroutput"><span class="identifier">T</span></code>,
when <code class="computeroutput"><span class="identifier">P</span></code> accepts the input
and <code class="computeroutput"><span class="identifier">F</span></code> otherwise.
</p>
<h2>
<a name="metaparse.reference.alphabetical.if.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.if.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.if.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">if_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.if.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.if.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.if.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser, <code class="computeroutput"><span class="identifier">t</span></code> and <code class="computeroutput"><span class="identifier">f</span></code>
classes the following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">if_</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">t</span><span class="special">,</span> <span class="identifier">f</span><span class="special">&gt;</span>
<span class="identifier">one_of</span><span class="special">&lt;</span><span class="identifier">last_of</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">return_</span><span class="special">&lt;</span><span class="identifier">t</span><span class="special">&gt;&gt;,</span> <span class="identifier">return_</span><span class="special">&lt;</span><span class="identifier">f</span><span class="special">&gt;&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.if.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.if.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.if.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">if_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">int11</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">11</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">int13</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">if_</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">,</span> <span class="identifier">int11</span><span class="special">,</span> <span class="identifier">int13</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"1234"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">11</span><span class="special">,</span>
<span class="string">"When the int_ parser succeeds, the result of parsing should be 11"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">if_</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">,</span> <span class="identifier">int11</span><span class="special">,</span> <span class="identifier">int13</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"foo"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">13</span><span class="special">,</span>
<span class="string">"When the int_ parser fails, the result of parsing should be 13"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.index_out_of_range"></a><a name="index_out_of_range"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.index_out_of_range" title="index_out_of_range">index_out_of_range</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.index_out_of_range.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.index_out_of_range.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.index_out_of_range.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">error</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">int</span> <span class="identifier">From</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">To</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">N</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">index_out_of_range</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parsing_error_message">parsing error message</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.index_out_of_range.arguments"></a><p class="title"><b>Table 24.39. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">From</span></code>
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="keyword">int</span></code> value. The lower
bound of the range.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">To</span></code>
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="keyword">int</span></code> value. The upper
bound of the range.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">N</span></code>
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="keyword">int</span></code> value. The value
outside of the range.
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.index_out_of_range.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.index_out_of_range.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.index_out_of_range.description">Description</a>
</h2>
<p>
Template class representing an over or under indexing error. <code class="computeroutput"><span class="identifier">From</span></code> and <code class="computeroutput"><span class="identifier">To</span></code>
represent the range and <code class="computeroutput"><span class="identifier">N</span></code>
is the value outside of the range.
</p>
<h2>
<a name="metaparse.reference.alphabetical.index_out_of_range.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.index_out_of_range.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.index_out_of_range.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">error</span><span class="special">/</span><span class="identifier">index_out_of_range</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.in_range_c"></a><a name="in_range_c"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.in_range_c" title="in_range_c">in_range_c</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.in_range_c.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.in_range_c.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.in_range_c.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">util</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">T</span> <span class="identifier">LowerBound</span><span class="special">,</span> <span class="identifier">T</span> <span class="identifier">UpperBound</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">in_range_c</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">U</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">apply</span><span class="special">;</span>
<span class="special">};</span>
<span class="special">}</span>
</pre>
<p>
This is a <a class="link" href="reference.html#metafunction_class">template metafunction class</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.in_range_c.arguments"></a><p class="title"><b>Table 24.40. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">T</span></code>
</p>
</td>
<td>
<p>
integral type
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">LowerBound</span></code>
</p>
</td>
<td>
<p>
value of type <code class="computeroutput"><span class="identifier">T</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">UpperBound</span></code>
</p>
</td>
<td>
<p>
value of type <code class="computeroutput"><span class="identifier">T</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">U</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#boxed_value">boxed integral value</a>
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.in_range_c.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.in_range_c.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.in_range_c.description">Description</a>
</h2>
<p>
Metafunction class verifying that <code class="computeroutput"><span class="identifier">U</span></code>
is in the <code class="computeroutput"><span class="special">[</span><span class="identifier">LowerBound</span><span class="special">..</span><span class="identifier">UpperBound</span><span class="special">]</span></code> range or not.
</p>
<h2>
<a name="metaparse.reference.alphabetical.in_range_c.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.in_range_c.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.in_range_c.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">in_range_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.in_range_c.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.in_range_c.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.in_range_c.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">T</span></code> integral type,
<code class="computeroutput"><span class="identifier">A</span></code>, <code class="computeroutput"><span class="identifier">B</span></code>
values of type <code class="computeroutput"><span class="identifier">T</span></code> and <code class="computeroutput"><span class="identifier">C</span></code> wrapped value the following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">in_range_c</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">A</span><span class="special">,</span> <span class="identifier">B</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span>
<span class="identifier">A</span> <span class="special">&lt;=</span> <span class="identifier">C</span><span class="special">::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">&amp;&amp;</span> <span class="identifier">C</span><span class="special">::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">&lt;=</span> <span class="identifier">B</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.in_range_c.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.in_range_c.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.in_range_c.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">in_range_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">util</span><span class="special">::</span><span class="identifier">in_range_c</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">11</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;</span>
<span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">10</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"A value below the lower bound should not be in the range"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">util</span><span class="special">::</span><span class="identifier">in_range_c</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">11</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;</span>
<span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">14</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"A value above the upper bound should not be in the range"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">in_range_c</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">11</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;</span>
<span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">11</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"The lower bound should be in the range"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">in_range_c</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">11</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;</span>
<span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"The upper bound should be in the range"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">in_range_c</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">11</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;</span>
<span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">12</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"A value between the bounds should be in the range"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.in_range"></a><a name="in_range"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.in_range" title="in_range">in_range</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.in_range.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.in_range.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.in_range.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">util</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">LowerBound</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">UpperBound</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Item</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">in_range</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
This is a <a class="link" href="reference.html#metafunction">template metafunction</a> supporting
<a class="link" href="reference.html#currying">currying</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.in_range.arguments"></a><p class="title"><b>Table 24.41. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">LowerBound</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#boxed_value">boxed integral value</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">UpperBound</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#boxed_value">boxed integral value</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Item</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#boxed_value">boxed integral value</a>
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.in_range.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.in_range.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.in_range.description">Description</a>
</h2>
<p>
It returns a boxed boolean value. The value is <code class="computeroutput"><span class="keyword">true</span></code>
when <code class="computeroutput"><span class="identifier">Item</span></code> is in the range
<code class="computeroutput"><span class="special">[</span><span class="identifier">LowerBound</span><span class="special">..</span><span class="identifier">UpperBound</span><span class="special">]</span></code> and <code class="computeroutput"><span class="keyword">false</span></code>
otherwise. <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">less_equal</span></code> is used for comparison.
</p>
<h2>
<a name="metaparse.reference.alphabetical.in_range.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.in_range.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.in_range.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">in_range</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.in_range.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.in_range.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.in_range.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">L</span></code>, <code class="computeroutput"><span class="identifier">U</span></code> and <code class="computeroutput"><span class="identifier">T</span></code>
classes the following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">in_range</span><span class="special">&lt;</span><span class="identifier">L</span><span class="special">,</span> <span class="identifier">U</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">less_equal</span><span class="special">&lt;</span><span class="identifier">L</span><span class="special">,</span> <span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span>
<span class="special">&amp;&amp;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">less_equal</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">U</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.in_range.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.in_range.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.in_range.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">in_range</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="keyword">int</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">util</span><span class="special">::</span><span class="identifier">in_range</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">11</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">13</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">10</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"A value below the lower bound should not be in the range"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">util</span><span class="special">::</span><span class="identifier">in_range</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">11</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">13</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">14</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"A value above the upper bound should not be in the range"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">in_range</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">11</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">13</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">11</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"The lower bound should be in the range"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">in_range</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">11</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">13</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">13</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"The upper bound should be in the range"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">in_range</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">11</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">13</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">12</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"A value between the bounds should be in the range"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">in_range</span><span class="special">&lt;&gt;</span>
<span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">11</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">13</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">12</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="special">::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"It should support currying"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.int"></a><a name="int_"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.int" title="int_">int_</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.int.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.int.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.int.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">int_</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser">parser</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.int.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.int.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.int.description">Description</a>
</h2>
<p>
It accepts a non-empty sequence of characters in the range <code class="computeroutput"><span class="number">0</span><span class="special">-</span><span class="number">9</span></code>.
The result of the parser is the decimal value represented by the accepted
character sequence.
</p>
<h2>
<a name="metaparse.reference.alphabetical.int.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.int.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.int.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.int.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.int.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.int.expression_semantics">Expression
semantics</a>
</h2>
<p>
The following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">int_</span>
<span class="identifier">foldl1</span><span class="special">&lt;</span>
<span class="identifier">digit_val</span><span class="special">,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">plus</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">times</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_2</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">10</span><span class="special">&gt;&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_1</span>
<span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.int.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.int.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.int.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">int_</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"13"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">13</span><span class="special">,</span>
<span class="string">"It should parse an integer value"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"six"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"It should reject the input if it is not a number"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.int_to_digit_c"></a><a name="int_to_digit_c"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.int_to_digit_c" title="int_to_digit_c">int_to_digit_c</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.int_to_digit_c.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.int_to_digit_c.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.int_to_digit_c.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">util</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">int</span> <span class="identifier">C</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">int_to_digit_c</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
This is a template class similar to a <a class="link" href="reference.html#metafunction">template
metafunction</a> but taking an <code class="computeroutput"><span class="keyword">int</span></code>
value as argument.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.int_to_digit_c.arguments"></a><p class="title"><b>Table 24.42. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">C</span></code>
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="keyword">int</span></code> value in the
range <code class="computeroutput"><span class="special">[</span><span class="number">0</span><span class="special">-</span><span class="number">9</span><span class="special">]</span></code>
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.int_to_digit_c.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.int_to_digit_c.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.int_to_digit_c.description">Description</a>
</h2>
<p>
Converts an integer value in the range <code class="computeroutput"><span class="special">[</span><span class="number">0</span><span class="special">-</span><span class="number">9</span><span class="special">]</span></code> to a character representing that decimal
value.
</p>
<h2>
<a name="metaparse.reference.alphabetical.int_to_digit_c.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.int_to_digit_c.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.int_to_digit_c.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">int_to_digit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.int_to_digit_c.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.int_to_digit_c.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.int_to_digit_c.expression_semantics">Expression
semantics</a>
</h2>
<p>
The following pairs of expressions are equivalent
</p>
<pre class="programlisting"><span class="identifier">int_to_digit_c</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'0'</span><span class="special">&gt;</span>
<span class="identifier">int_to_digit</span><span class="special">&lt;</span><span class="number">9</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'9'</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.int_to_digit_c.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.int_to_digit_c.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.int_to_digit_c.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">int_to_digit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">int_to_digit_c</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="char">'0'</span><span class="special">,</span>
<span class="string">"it should convert an integer value to the corresponding character"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">int_to_digit_c</span><span class="special">&lt;</span><span class="number">3</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="char">'3'</span><span class="special">,</span>
<span class="string">"it should convert an integer to the corresponding character"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">int_to_digit_c</span><span class="special">&lt;</span><span class="number">9</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="char">'9'</span><span class="special">,</span>
<span class="string">"it should convert an integer value to the corresponding character"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.int_to_digit"></a><a name="int_to_digit"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.int_to_digit" title="int_to_digit">int_to_digit</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.int_to_digit.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.int_to_digit.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.int_to_digit.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">util</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">D</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">int_to_digit</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
This is a <a class="link" href="reference.html#lazy_metafunction">lazy template metafunction</a>
that supports <a class="link" href="reference.html#currying">currying</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.int_to_digit.arguments"></a><p class="title"><b>Table 24.43. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">D</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#boxed_value">boxed</a> integer value
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.int_to_digit.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.int_to_digit.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.int_to_digit.description">Description</a>
</h2>
<p>
Converts a boxed integer value in the range <code class="computeroutput"><span class="special">[</span><span class="number">0</span><span class="special">-</span><span class="number">9</span><span class="special">]</span></code> to a character representing that decimal
value.
</p>
<h2>
<a name="metaparse.reference.alphabetical.int_to_digit.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.int_to_digit.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.int_to_digit.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">int_to_digit</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.int_to_digit.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.int_to_digit.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.int_to_digit.expression_semantics">Expression
semantics</a>
</h2>
<p>
The following pairs of expressions are equivalent
</p>
<pre class="programlisting"><span class="identifier">int_to_digit</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'0'</span><span class="special">&gt;</span>
<span class="identifier">int_to_digit</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">9</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'9'</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.int_to_digit.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.int_to_digit.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.int_to_digit.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">int_to_digit</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">struct</span> <span class="identifier">nullary_metafunction_returning_4</span>
<span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">4</span><span class="special">&gt;;</span>
<span class="special">};</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">int_to_digit</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">0</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="char">'0'</span><span class="special">,</span>
<span class="string">"it should convert an integer value to the corresponding character"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">int_to_digit</span><span class="special">&lt;&gt;::</span><span class="identifier">type</span>
<span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">7</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="char">'7'</span><span class="special">,</span>
<span class="string">"it should support currying"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">int_to_digit</span><span class="special">&lt;</span><span class="identifier">nullary_metafunction_returning_4</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="char">'4'</span><span class="special">,</span>
<span class="string">"it should support lazy evaluation"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.is_digit"></a><a name="is_digit"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.is_digit" title="is_digit">is_digit</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.is_digit.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_digit.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_digit.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">util</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">C</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">is_digit</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
This is a <a class="link" href="reference.html#lazy_metafunction">lazy template metafunction</a>
that supports <a class="link" href="reference.html#currying">currying</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.is_digit.arguments"></a><p class="title"><b>Table 24.44. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">C</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#boxed_value">boxed</a> character value
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.is_digit.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_digit.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_digit.description">Description</a>
</h2>
<p>
Checks if <code class="computeroutput"><span class="identifier">C</span></code> is a digit
value or not. Returns a boxed boolean value.
</p>
<h2>
<a name="metaparse.reference.alphabetical.is_digit.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_digit.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_digit.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">is_digit</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.is_digit.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_digit.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_digit.expression_semantics">Expression
semantics</a>
</h2>
<p>
The following expressions are equivalent:
</p>
<pre class="programlisting"><span class="identifier">is_digit</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'0'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="identifier">is_digit</span><span class="special">&lt;&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'0'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span>
</pre>
<p>
The following expressions are also equivalent:
</p>
<pre class="programlisting"><span class="identifier">is_digit</span><span class="special">&lt;&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">c</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">false_</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.is_digit.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_digit.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_digit.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">is_digit</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">struct</span> <span class="identifier">returns_char</span>
<span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'0'</span><span class="special">&gt;;</span>
<span class="special">};</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">is_digit</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'0'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"digit character should be a digit"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">util</span><span class="special">::</span><span class="identifier">is_digit</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'x'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"letter should not be a digit"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">is_digit</span><span class="special">&lt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'0'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should support currying"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">is_digit</span><span class="special">&lt;</span><span class="identifier">returns_char</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should support lazy evaluation"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.is_error"></a><a name="is_error"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.is_error" title="is_error">is_error</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.is_error.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_error.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_error.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">C</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">is_error</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#lazy_metafunction">lazy template metafunction</a>
that supports <a class="link" href="reference.html#currying">currying</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.is_error.arguments"></a><p class="title"><b>Table 24.45. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">C</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#accept">accept</a> or <a class="link" href="reference.html#reject">reject</a>
value
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.is_error.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_error.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_error.description">Description</a>
</h2>
<p>
Determines if <code class="computeroutput"><span class="identifier">C</span></code> is a parsing
error or not. Returns a <a class="link" href="reference.html#boxed_value">boxed</a> boolean
value.
</p>
<h2>
<a name="metaparse.reference.alphabetical.is_error.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_error.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_error.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.is_error.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_error.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_error.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">e</span></code> parsing error
<code class="computeroutput"><span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">c</span><span class="special">&gt;::</span><span class="identifier">type</span></code> is a wrapped compile-time <code class="computeroutput"><span class="keyword">true</span></code> value, for any other <code class="computeroutput"><span class="identifier">c</span></code> class <code class="computeroutput"><span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">c</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
is a wrapped compile-time <code class="computeroutput"><span class="keyword">false</span></code>
value.
</p>
<h2>
<a name="metaparse.reference.alphabetical.is_error.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_error.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_error.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">accept</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">reject</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">define_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="identifier">BOOST_METAPARSE_DEFINE_ERROR</span><span class="special">(</span><span class="identifier">sample_error</span><span class="special">,</span> <span class="string">"Sample error message"</span><span class="special">);</span>
<span class="keyword">struct</span> <span class="identifier">returns_reject</span>
<span class="special">{</span>
<span class="keyword">typedef</span> <span class="identifier">reject</span><span class="special">&lt;</span><span class="identifier">sample_error</span><span class="special">,</span> <span class="identifier">start</span><span class="special">&gt;</span> <span class="identifier">type</span><span class="special">;</span>
<span class="special">};</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">accept</span><span class="special">&lt;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;,</span>
<span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"foo"</span><span class="special">),</span>
<span class="identifier">start</span>
<span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"an accept should not be an error"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">reject</span><span class="special">&lt;</span><span class="identifier">sample_error</span><span class="special">,</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"an reject should be an error"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">reject</span><span class="special">&lt;</span><span class="identifier">sample_error</span><span class="special">,</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should support currying"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">returns_reject</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should support lazy evaluation"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.is_lcase_letter"></a><a name="is_lcase_letter"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.is_lcase_letter" title="is_lcase_letter">is_lcase_letter</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.is_lcase_letter.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_lcase_letter.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_lcase_letter.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">util</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">C</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">is_lcase_letter</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
This is a <a class="link" href="reference.html#lazy_metafunction">lazy template metafunction</a>
that supports <a class="link" href="reference.html#currying">currying</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.is_lcase_letter.arguments"></a><p class="title"><b>Table 24.46. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">C</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#boxed_value">boxed</a> character value
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.is_lcase_letter.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_lcase_letter.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_lcase_letter.description">Description</a>
</h2>
<p>
Checks if <code class="computeroutput"><span class="identifier">C</span></code> is a lower
case letter. Returns a boxed boolean value.
</p>
<h2>
<a name="metaparse.reference.alphabetical.is_lcase_letter.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_lcase_letter.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_lcase_letter.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">is_lcase_letter</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.is_lcase_letter.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_lcase_letter.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_lcase_letter.expression_semantics">Expression
semantics</a>
</h2>
<p>
The following expressions are equivalent:
</p>
<pre class="programlisting"><span class="identifier">is_lcase_letter</span><span class="special">&lt;&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'a'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span>
<span class="identifier">is_lcase_letter</span><span class="special">&lt;&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'z'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span>
<span class="identifier">is_lcase_letter</span><span class="special">&lt;&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">c</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">false_</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.is_lcase_letter.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_lcase_letter.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_lcase_letter.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">is_lcase_letter</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">struct</span> <span class="identifier">returns_char</span>
<span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'a'</span><span class="special">&gt;;</span>
<span class="special">};</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">is_lcase_letter</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'a'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"a should be a lower case letter"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">util</span><span class="special">::</span><span class="identifier">is_lcase_letter</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'A'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"A should not be a lower case letter"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">is_lcase_letter</span><span class="special">&lt;&gt;::</span><span class="identifier">type</span>
<span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'a'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should support currying"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">is_lcase_letter</span><span class="special">&lt;</span><span class="identifier">returns_char</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should support lazy evaluation"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.is_letter"></a><a name="is_letter"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.is_letter" title="is_letter">is_letter</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.is_letter.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_letter.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_letter.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">util</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">C</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">is_letter</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
This is a <a class="link" href="reference.html#lazy_metafunction">lazy template metafunction</a>
that supports <a class="link" href="reference.html#currying">currying</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.is_letter.arguments"></a><p class="title"><b>Table 24.47. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">C</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#boxed_value">boxed</a> character value
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.is_letter.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_letter.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_letter.description">Description</a>
</h2>
<p>
Checks if <code class="computeroutput"><span class="identifier">C</span></code> is a letter.
Returns a boxed boolean value.
</p>
<h2>
<a name="metaparse.reference.alphabetical.is_letter.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_letter.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_letter.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">is_letter</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.is_letter.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_letter.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_letter.expression_semantics">Expression
semantics</a>
</h2>
<p>
The following expressions are equivalent:
</p>
<pre class="programlisting"><span class="identifier">is_letter</span><span class="special">&lt;&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'a'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span>
<span class="identifier">is_letter</span><span class="special">&lt;&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'z'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span>
<span class="identifier">is_letter</span><span class="special">&lt;&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'A'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span>
<span class="identifier">is_letter</span><span class="special">&lt;&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'Z'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span>
<span class="identifier">is_letter</span><span class="special">&lt;&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">c</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">false_</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.is_letter.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_letter.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_letter.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">is_letter</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">struct</span> <span class="identifier">returns_char</span>
<span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'A'</span><span class="special">&gt;;</span>
<span class="special">};</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">is_letter</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'A'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"A should be a letter"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">util</span><span class="special">::</span><span class="identifier">is_letter</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'0'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"a number should not be a letter"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">is_letter</span><span class="special">&lt;&gt;::</span><span class="identifier">type</span>
<span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'A'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should support currying"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">is_letter</span><span class="special">&lt;</span><span class="identifier">returns_char</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should support lazy evaluation"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.is_ucase_letter"></a><a name="is_ucase_letter"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.is_ucase_letter" title="is_ucase_letter">is_ucase_letter</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.is_ucase_letter.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_ucase_letter.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_ucase_letter.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">util</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">C</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">is_ucase_letter</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
This is a <a class="link" href="reference.html#lazy_metafunction">lazy template metafunction</a>
that supports <a class="link" href="reference.html#currying">currying</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.is_ucase_letter.arguments"></a><p class="title"><b>Table 24.48. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">C</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#boxed_value">boxed</a> character value
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.is_ucase_letter.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_ucase_letter.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_ucase_letter.description">Description</a>
</h2>
<p>
Checks if <code class="computeroutput"><span class="identifier">C</span></code> is an upper
case letter. Returns a boxed boolean value.
</p>
<h2>
<a name="metaparse.reference.alphabetical.is_ucase_letter.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_ucase_letter.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_ucase_letter.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">is_ucase_letter</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.is_ucase_letter.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_ucase_letter.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_ucase_letter.expression_semantics">Expression
semantics</a>
</h2>
<p>
The following expressions are equivalent:
</p>
<pre class="programlisting"><span class="identifier">is_ucase_letter</span><span class="special">&lt;&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'A'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span>
<span class="identifier">is_ucase_letter</span><span class="special">&lt;&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'Z'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span>
<span class="identifier">is_ucase_letter</span><span class="special">&lt;&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">c</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">false_</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.is_ucase_letter.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_ucase_letter.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_ucase_letter.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">is_ucase_letter</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">struct</span> <span class="identifier">returns_char</span>
<span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'A'</span><span class="special">&gt;;</span>
<span class="special">};</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">is_ucase_letter</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'A'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"A should be an upper case letter"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">util</span><span class="special">::</span><span class="identifier">is_ucase_letter</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'a'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"a should not be an upper case letter"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">is_ucase_letter</span><span class="special">&lt;&gt;::</span><span class="identifier">type</span>
<span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'A'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should support currying"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">is_ucase_letter</span><span class="special">&lt;</span><span class="identifier">returns_char</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should support lazy evaluation"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.is_whitespace_c"></a><a name="is_whitespace_c"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.is_whitespace_c" title="is_whitespace_c">is_whitespace_c</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.is_whitespace_c.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_whitespace_c.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_whitespace_c.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">util</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">char</span> <span class="identifier">C</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">is_whitespace_c</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
This is a template class similar to a <a class="link" href="reference.html#metafunction">template
metafunction</a> but taking a <code class="computeroutput"><span class="keyword">char</span></code>
value as argument.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.is_whitespace_c.arguments"></a><p class="title"><b>Table 24.49. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">D</span></code>
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="keyword">char</span></code> value
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.is_whitespace_c.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_whitespace_c.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_whitespace_c.description">Description</a>
</h2>
<p>
Checks if <code class="computeroutput"><span class="identifier">C</span></code> is a whitespace
character. Returns a boxed boolean value.
</p>
<h2>
<a name="metaparse.reference.alphabetical.is_whitespace_c.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_whitespace_c.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_whitespace_c.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">is_whitespace_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.is_whitespace_c.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_whitespace_c.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_whitespace_c.expression_semantics">Expression
semantics</a>
</h2>
<p>
The following expressions are equivalent:
</p>
<pre class="programlisting"><span class="identifier">is_whitespace_c</span><span class="special">&lt;</span><span class="char">' '</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span>
<span class="identifier">is_whitespace_c</span><span class="special">&lt;</span><span class="char">'\t'</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span>
<span class="identifier">is_whitespace_c</span><span class="special">&lt;</span><span class="char">'\r'</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span>
<span class="identifier">is_whitespace_c</span><span class="special">&lt;</span><span class="char">'\n'</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span>
</pre>
<p>
For any <code class="computeroutput"><span class="identifier">c</span></code> character other
than the above listed ones the following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">is_whitespace_c</span><span class="special">&lt;</span><span class="identifier">c</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">false_</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.is_whitespace_c.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_whitespace_c.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_whitespace_c.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">is_whitespace_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">is_whitespace_c</span><span class="special">&lt;</span><span class="char">' '</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"a space should be a whitespace character"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">util</span><span class="special">::</span><span class="identifier">is_whitespace_c</span><span class="special">&lt;</span><span class="char">'0'</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"a number should not be a whitespace character"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.is_whitespace"></a><a name="is_whitespace"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.is_whitespace" title="is_whitespace">is_whitespace</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.is_whitespace.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_whitespace.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_whitespace.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">util</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">C</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">is_whitespace</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
This is a <a class="link" href="reference.html#lazy_metafunction">lazy template metafunction</a>
that supports <a class="link" href="reference.html#currying">currying</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.is_whitespace.arguments"></a><p class="title"><b>Table 24.50. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">C</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#boxed_value">boxed</a> character value
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.is_whitespace.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_whitespace.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_whitespace.description">Description</a>
</h2>
<p>
Checks if <code class="computeroutput"><span class="identifier">C</span></code> is a whitespace
character. Returns a boxed boolean value.
</p>
<h2>
<a name="metaparse.reference.alphabetical.is_whitespace.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_whitespace.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_whitespace.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">is_whitespace</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.is_whitespace.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_whitespace.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_whitespace.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">C</span></code> nullary template
metafunction returning a wrapped character value the following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">is_whitespace</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="identifier">is_whitespace</span><span class="special">&lt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="identifier">is_whitespace_c</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">&gt;::</span><span class="identifier">type</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.is_whitespace.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.is_whitespace.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.is_whitespace.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">is_whitespace</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">struct</span> <span class="identifier">returns_char</span>
<span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">' '</span><span class="special">&gt;;</span>
<span class="special">};</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">is_whitespace</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">' '</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"a space should be a whitespace character"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">util</span><span class="special">::</span><span class="identifier">is_whitespace</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'0'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"a number should not be a whitespace character"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">is_whitespace</span><span class="special">&lt;&gt;::</span><span class="identifier">type</span>
<span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'\t'</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should support currying"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">is_whitespace</span><span class="special">&lt;</span><span class="identifier">returns_char</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should support lazy evaluation"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.iterate_c"></a><a name="iterate_c"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.iterate_c" title="iterate_c">iterate_c</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.iterate_c.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.iterate_c.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.iterate_c.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">N</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">iterate_c</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.iterate_c.arguments"></a><p class="title"><b>Table 24.51. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">N</span></code>
</p>
</td>
<td>
<p>
non-negative integer value
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.iterate_c.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.iterate_c.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.iterate_c.description">Description</a>
</h2>
<p>
It applies <code class="computeroutput"><span class="identifier">P</span></code> on the input
string <code class="computeroutput"><span class="identifier">N</span></code> times. The result
of parsing is a sequence of the results of the individual applications
of <code class="computeroutput"><span class="identifier">P</span></code>. <code class="computeroutput"><span class="identifier">P</span></code>
has to accept the input <code class="computeroutput"><span class="identifier">N</span></code>
times for <code class="computeroutput"><span class="identifier">iterate_c</span></code> to
accept it.
</p>
<h2>
<a name="metaparse.reference.alphabetical.iterate_c.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.iterate_c.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.iterate_c.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">iterate_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.iterate_c.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.iterate_c.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.iterate_c.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser, <code class="computeroutput"><span class="identifier">n</span></code> integer value the following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">iterate_c</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">n</span><span class="special">&gt;</span>
<span class="identifier">sequence</span><span class="special">&lt;</span>
<span class="identifier">p</span><span class="special">,</span> <span class="comment">// 1.</span>
<span class="identifier">p</span><span class="special">,</span> <span class="comment">// 2.</span>
<span class="comment">// ...</span>
<span class="identifier">p</span> <span class="comment">// n.</span>
<span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.iterate_c.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.iterate_c.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.iterate_c.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">iterate_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">digit</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">vector</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">equal</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="keyword">char</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">equal</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'1'</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'2'</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'3'</span><span class="special">&gt;</span>
<span class="special">&gt;,</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">iterate_c</span><span class="special">&lt;</span><span class="identifier">digit</span><span class="special">,</span> <span class="number">3</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"123"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"the result should be the sequence of the individual applications of digit"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">equal</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'1'</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'2'</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'3'</span><span class="special">&gt;</span>
<span class="special">&gt;,</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">iterate_c</span><span class="special">&lt;</span><span class="identifier">digit</span><span class="special">,</span> <span class="number">3</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"1234"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"only three iterations should be made"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">iterate_c</span><span class="special">&lt;</span><span class="identifier">digit</span><span class="special">,</span> <span class="number">3</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"12"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should fail when digit can not be applied three times"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.iterate"></a><a name="iterate"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.iterate" title="iterate">iterate</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.iterate.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.iterate.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.iterate.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">N</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">iterate</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.iterate.arguments"></a><p class="title"><b>Table 24.52. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">N</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#boxed_value">boxed</a> non-negative integer
value
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.iterate.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.iterate.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.iterate.description">Description</a>
</h2>
<p>
It applies <code class="computeroutput"><span class="identifier">P</span></code> on the input
string <code class="computeroutput"><span class="identifier">N</span></code> times. The result
of parsing is a sequence of the results of the individual applications
of <code class="computeroutput"><span class="identifier">P</span></code>. <code class="computeroutput"><span class="identifier">P</span></code>
has to accept the input <code class="computeroutput"><span class="identifier">N</span></code>
times for <code class="computeroutput"><span class="identifier">iterate</span></code> to accept
it.
</p>
<h2>
<a name="metaparse.reference.alphabetical.iterate.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.iterate.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.iterate.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">iterate</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.iterate.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.iterate.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.iterate.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser, <code class="computeroutput"><span class="identifier">n</span></code> wrapped integer the following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">iterate</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">n</span><span class="special">&gt;</span>
<span class="identifier">iterate_c</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">n</span><span class="special">::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.iterate.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.iterate.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.iterate.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">iterate</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">digit</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">vector</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">equal</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="keyword">char</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">equal</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'1'</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'2'</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'3'</span><span class="special">&gt;</span>
<span class="special">&gt;,</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">iterate</span><span class="special">&lt;</span><span class="identifier">digit</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">3</span><span class="special">&gt;&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span>
<span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"123"</span><span class="special">),</span>
<span class="identifier">start</span>
<span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"the result should be the sequence of the individual applications of digit"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">equal</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'1'</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'2'</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'3'</span><span class="special">&gt;</span>
<span class="special">&gt;,</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">iterate</span><span class="special">&lt;</span><span class="identifier">digit</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">3</span><span class="special">&gt;&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span>
<span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"1234"</span><span class="special">),</span>
<span class="identifier">start</span>
<span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"only three iterations should be made"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">iterate</span><span class="special">&lt;</span><span class="identifier">digit</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">3</span><span class="special">&gt;&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span>
<span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"12"</span><span class="special">),</span>
<span class="identifier">start</span>
<span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should fail when digit can not be applied three times"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.keyword"></a><a name="keyword"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.keyword" title="keyword">keyword</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.keyword.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.keyword.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.keyword.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">S</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">ResultType</span> <span class="special">=</span> <span class="comment">/* unspecified */</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">keyword</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser">parser</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.keyword.arguments"></a><p class="title"><b>Table 24.53. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">S</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#string">string</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">ResultType</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a>
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.keyword.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.keyword.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.keyword.description">Description</a>
</h2>
<p>
Parser accepting the keyword <code class="computeroutput"><span class="identifier">S</span></code>.
The result of parsing is <code class="computeroutput"><span class="identifier">ResultType</span></code>,
which is optional; when not given, the result of successful parsing is
undefined.
</p>
<h2>
<a name="metaparse.reference.alphabetical.keyword.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.keyword.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.keyword.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">keyword</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.keyword.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.keyword.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.keyword.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">r</span></code> class and <code class="computeroutput"><span class="identifier">s</span></code> compile-time string that is built from
the characters <code class="computeroutput"><span class="identifier">c1</span></code> ...
<code class="computeroutput"><span class="identifier">cn</span></code> the following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">keyword</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">r</span><span class="special">&gt;</span>
<span class="identifier">last_of</span><span class="special">&lt;</span><span class="identifier">lit</span><span class="special">&lt;</span><span class="identifier">c1</span><span class="special">&gt;,</span> <span class="comment">/* ... */</span><span class="special">,</span> <span class="identifier">lit</span><span class="special">&lt;</span><span class="identifier">cn</span><span class="special">&gt;,</span> <span class="identifier">return_</span><span class="special">&lt;</span><span class="identifier">r</span><span class="special">&gt;&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.keyword.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.keyword.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.keyword.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">keyword</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">keyword</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"for"</span><span class="special">),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;&gt;</span>
<span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"for"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">13</span><span class="special">,</span>
<span class="string">"the result of parsing the keyword is keyword's second argument"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">keyword</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"for"</span><span class="special">),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;&gt;</span>
<span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"if"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"a word other than the keyword is an error"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.last_of"></a><a name="last_of"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.last_of" title="last_of">last_of</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.last_of.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.last_of.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.last_of.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span><span class="special">...</span> <span class="identifier">Ps</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">last_of</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.last_of.arguments"></a><p class="title"><b>Table 24.54. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Ps</span><span class="special">...</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>s
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.last_of.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.last_of.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.last_of.description">Description</a>
</h2>
<p>
<code class="computeroutput"><span class="identifier">last_of</span></code> applies the <code class="computeroutput"><span class="identifier">Ps</span><span class="special">...</span></code>
parsers in sequence. It accepts an input when all parsers accept it. The
result of parsing is the result of the last parser.
</p>
<p>
On compilers, which are not C++11-compliant, the maximum number of parsers
<code class="computeroutput"><span class="identifier">last_of</span></code> accepts can be
specified with the <code class="computeroutput"><span class="identifier">BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE</span></code>
macro. Its default value is <code class="computeroutput"><span class="number">5</span></code>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.last_of.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.last_of.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.last_of.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">last_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.last_of.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.last_of.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.last_of.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p1</span></code>, ... <code class="computeroutput"><span class="identifier">pn</span></code> parsers
</p>
<pre class="programlisting"><span class="identifier">first_of</span><span class="special">&lt;</span><span class="identifier">p1</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">pn</span><span class="special">&gt;</span>
</pre>
<p>
is equivalent to
</p>
<pre class="programlisting"><span class="identifier">nth_of_c</span><span class="special">&lt;</span><span class="identifier">n</span><span class="special">,</span> <span class="identifier">p1</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">pn</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.last_of.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.last_of.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.last_of.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">last_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">comma_int</span> <span class="special">=</span> <span class="identifier">last_of</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">','</span><span class="special">&gt;,</span> <span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">comma_int</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"13"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"int without comma is rejected"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">comma_int</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">",13"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"the result is the result of the last parser"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.lazy_template_metafunction"></a><a name="lazy_metafunction"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.lazy_template_metafunction" title="Lazy template metafunction">Lazy
template metafunction</a>
</h4></div></div></div>
<p>
A <span class="emphasis"><em>lazy template metafunction</em></span> is a <a class="link" href="reference.html#metafunction">template
metafunction</a> that accepts <a class="link" href="reference.html#nullary_metafunction">nullary
metafunction</a>s as arguments, that need to be evaluated first to get
the value of the argument.
</p>
<p>
For example here is a <code class="computeroutput"><span class="identifier">plus</span></code>
metafunction for <code class="computeroutput"><span class="keyword">int</span></code> values:
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">B</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">plus</span> <span class="special">:</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">A</span><span class="special">::</span><span class="identifier">value</span> <span class="special">+</span> <span class="identifier">B</span><span class="special">::</span><span class="identifier">value</span><span class="special">&gt;</span>
<span class="special">{};</span>
</pre>
<p>
This metafunction takes two <a class="link" href="reference.html#boxed_value">boxed</a> numbers
as arguments, unboxes them, adds their values and boxed the result again.
</p>
<p>
It works when it is called with boxed numbers. For example:
</p>
<pre class="programlisting"><span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">plus</span><span class="special">&lt;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">intgeral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">2</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">2</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">4</span><span class="special">,</span>
<span class="string">"This should work"</span>
<span class="special">);</span>
</pre>
<p>
However, when it is called with a nullary metafunction returning the boxed
value, it breaks:
</p>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">nullary_metafunction_returning_2</span>
<span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">2</span><span class="special">&gt;;</span>
<span class="special">};</span>
<span class="comment">// Fails to compile</span>
<span class="identifier">plus</span><span class="special">&lt;</span><span class="identifier">nullary_metafunction_returning_2</span><span class="special">,</span> <span class="identifier">nullary_metafunction_returning_2</span><span class="special">&gt;::</span><span class="identifier">type</span>
</pre>
<p>
So <code class="computeroutput"><span class="identifier">plus</span></code> is <span class="emphasis"><em>not</em></span>
a lazy template metafunction. To make it lazy, it has to evaluate its arguments
before using them:
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">B</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">lazy_plus</span> <span class="special">:</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">A</span><span class="special">::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">+</span> <span class="identifier">B</span><span class="special">::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">&gt;</span>
<span class="special">{};</span>
</pre>
<p>
Note that it uses <code class="computeroutput"><span class="identifier">A</span><span class="special">::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span></code> and <code class="computeroutput"><span class="identifier">B</span><span class="special">::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span></code>
instead of <code class="computeroutput"><span class="identifier">A</span><span class="special">::</span><span class="identifier">value</span></code> and <code class="computeroutput"><span class="identifier">B</span><span class="special">::</span><span class="identifier">value</span></code>.
It works when it is called with nullary metafunctions as well:
</p>
<pre class="programlisting"><span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">plus</span><span class="special">&lt;</span>
<span class="identifier">nullary_metafunction_returning_2</span><span class="special">,</span>
<span class="identifier">nullary_metafunction_returning_2</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">4</span><span class="special">,</span>
<span class="string">"This should work"</span>
<span class="special">);</span>
</pre>
<p>
Because it works with nullary metafunctions as arguments, it is a lazy
template metafunction.
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.letter_expected"></a><a name="letter_expected"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.letter_expected" title="letter_expected">letter_expected</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.letter_expected.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.letter_expected.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.letter_expected.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">error</span>
<span class="special">{</span>
<span class="keyword">struct</span> <span class="identifier">letter_expected</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parsing_error_message">parsing error message</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.letter_expected.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.letter_expected.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.letter_expected.description">Description</a>
</h2>
<p>
Class representing the error that a letter character was expected at a
specific location.
</p>
<h2>
<a name="metaparse.reference.alphabetical.letter_expected.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.letter_expected.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.letter_expected.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">error</span><span class="special">/</span><span class="identifier">letter_expected</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.letter"></a><a name="letter"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.letter" title="letter">letter</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.letter.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.letter.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.letter.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">letter</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser">parser</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.letter.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.letter.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.letter.description">Description</a>
</h2>
<p>
Parser accepting one character in the range <code class="computeroutput"><span class="identifier">a</span><span class="special">-</span><span class="identifier">z</span></code> or
<code class="computeroutput"><span class="identifier">A</span><span class="special">-</span><span class="identifier">Z</span></code>. The result of the parser is the accepted
character.
</p>
<h2>
<a name="metaparse.reference.alphabetical.letter.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.letter.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.letter.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">letter</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.letter.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.letter.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.letter.expression_semantics">Expression
semantics</a>
</h2>
<p>
The following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">letter</span>
<span class="identifier">accept_when</span><span class="special">&lt;</span><span class="identifier">one_char</span><span class="special">,</span> <span class="identifier">util</span><span class="special">::</span><span class="identifier">is_letter</span><span class="special">&lt;&gt;,</span> <span class="identifier">error</span><span class="special">::</span><span class="identifier">letter_expected</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.letter.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.letter.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.letter.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">letter</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">letter</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"a"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"letter should accept a letter"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">letter</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"0"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"letter should reject a digit"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">letter</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"z"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="char">'z'</span><span class="special">,</span>
<span class="string">"the result of parsing should be the character value"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.lit_c"></a><a name="lit_c"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.lit_c" title="lit_c">lit_c</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.lit_c.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.lit_c.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.lit_c.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">char</span> <span class="identifier">C</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">lit</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser">parser</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.lit_c.arguments"></a><p class="title"><b>Table 24.55. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">C</span></code>
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="keyword">char</span></code> value
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.lit_c.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.lit_c.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.lit_c.description">Description</a>
</h2>
<p>
Parser accepting only the <code class="computeroutput"><span class="identifier">C</span></code>
character. The result of parsing is the accepted character.
</p>
<h2>
<a name="metaparse.reference.alphabetical.lit_c.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.lit_c.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.lit_c.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.lit_c.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.lit_c.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.lit_c.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">c</span></code> character the
following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="identifier">c</span><span class="special">&gt;</span>
<span class="identifier">lit</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="identifier">c</span><span class="special">&gt;&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.lit_c.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.lit_c.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.lit_c.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'x'</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"a"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"a different character should be an error"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'x'</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">""</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"empty input should be an error"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'x'</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"x"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="char">'x'</span><span class="special">,</span>
<span class="string">"result of parsing should be the accepted character"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.literal_expected"></a><a name="literal_expected"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.literal_expected" title="literal_expected">literal_expected</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.literal_expected.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.literal_expected.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.literal_expected.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">error</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">char</span> <span class="identifier">C</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">literal_expected</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parsing_error_message">parsing error message</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.literal_expected.arguments"></a><p class="title"><b>Table 24.56. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">C</span></code>
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="keyword">char</span></code> value
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.literal_expected.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.literal_expected.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.literal_expected.description">Description</a>
</h2>
<p>
Template class representing the error that a specific literal was expected.
<code class="computeroutput"><span class="identifier">C</span></code> is the literal that was
expected but not found.
</p>
<h2>
<a name="metaparse.reference.alphabetical.literal_expected.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.literal_expected.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.literal_expected.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">error</span><span class="special">/</span><span class="identifier">literal_expected</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.lit"></a><a name="lit"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.lit" title="lit">lit</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.lit.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.lit.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.lit.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">C</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">lit</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser">parser</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.lit.arguments"></a><p class="title"><b>Table 24.57. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">C</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#boxed_value">boxed</a> character value
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.lit.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.lit.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.lit.description">Description</a>
</h2>
<p>
Parser accepting only the <code class="computeroutput"><span class="identifier">C</span></code>
character. The result of parsing is the accepted character.
</p>
<h2>
<a name="metaparse.reference.alphabetical.lit.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.lit.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.lit.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.lit.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.lit.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.lit.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">c</span></code> boxed character
the following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">lit</span><span class="special">&lt;</span><span class="identifier">c</span><span class="special">&gt;</span>
<span class="identifier">accept_when</span><span class="special">&lt;</span>
<span class="identifier">one_char</span><span class="special">,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">equal_to</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_1</span><span class="special">,</span> <span class="identifier">c</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="identifier">error</span><span class="special">::</span><span class="identifier">literal_expected</span><span class="special">&lt;</span><span class="identifier">c</span><span class="special">::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">&gt;</span>
<span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.lit.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.lit.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.lit.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">lit</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'x'</span><span class="special">&gt;&gt;</span>
<span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"a"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"a different character should be an error"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">lit</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'x'</span><span class="special">&gt;&gt;</span>
<span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">""</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"empty input should be an error"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">lit</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'x'</span><span class="special">&gt;&gt;</span>
<span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"x"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="char">'x'</span><span class="special">,</span>
<span class="string">"result of parsing should be the accepted character"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.look_ahead"></a><a name="look_ahead"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.look_ahead" title="look_ahead">look_ahead</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.look_ahead.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.look_ahead.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.look_ahead.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">look_ahead</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.look_ahead.arguments"></a><p class="title"><b>Table 24.58. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.look_ahead.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.look_ahead.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.look_ahead.description">Description</a>
</h2>
<p>
Parses the input using parser <code class="computeroutput"><span class="identifier">P</span></code>.
When <code class="computeroutput"><span class="identifier">P</span></code> returns an error,
<code class="computeroutput"><span class="identifier">look_ahead</span></code> returns the
error. When <code class="computeroutput"><span class="identifier">P</span></code> returns a
result, <code class="computeroutput"><span class="identifier">look_ahead</span></code> returns
the result without consuming anything from the input string.
</p>
<h2>
<a name="metaparse.reference.alphabetical.look_ahead.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.look_ahead.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.look_ahead.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">look_ahead</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.look_ahead.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.look_ahead.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.look_ahead.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser, <code class="computeroutput"><span class="identifier">s</span></code> compile-time string and <code class="computeroutput"><span class="identifier">pos</span></code> source position
</p>
<pre class="programlisting"><span class="identifier">look_ahead</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<p>
is equivalent to
</p>
<pre class="programlisting"><span class="identifier">return_</span><span class="special">&lt;</span><span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<p>
when <code class="computeroutput"><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span></code> succeeds. It is
</p>
<pre class="programlisting"><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<p>
otherwise.
</p>
<h2>
<a name="metaparse.reference.alphabetical.look_ahead.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.look_ahead.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.look_ahead.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">look_ahead</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_remaining</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">look_ahead</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"13"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">13</span><span class="special">,</span>
<span class="string">"it should return the same result as the wrapped parser"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
<span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"13"</span><span class="special">),</span>
<span class="identifier">get_remaining</span><span class="special">&lt;</span>
<span class="identifier">look_ahead</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"13"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should not consume any input"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">look_ahead</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"six"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should fail when the wrapped parser fails"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.template_metafunction_class"></a><a name="metafunction_class"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.template_metafunction_class" title="Template metafunction class">Template
metafunction class</a>
</h4></div></div></div>
<p>
A <span class="emphasis"><em>template metafunction class</em></span> is a type with a public
nested <a class="link" href="reference.html#metafunction">template metafunction</a> called
<code class="computeroutput"><span class="identifier">apply</span></code>. Since it is a type,
it can be passed to template metafunctions as arguments and metafunctions
can return it as their result. This makes it possible to implement <span class="emphasis"><em>higher-order
template metafunctions</em></span>, which are template metafunctions taking
template metafunctions as arguments or returning template metafunctions
as their result.
</p>
<p>
For example this is the identity template metafunction class:
</p>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">identity</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">apply</span>
<span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span> <span class="identifier">T</span><span class="special">;</span>
<span class="special">};</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span> <span class="identifier">identity</span><span class="special">;</span>
<span class="special">};</span>
</pre>
<p>
This metafunction class is called <code class="computeroutput"><span class="identifier">identity</span></code>.
It takes one argument, <code class="computeroutput"><span class="identifier">T</span></code>.
The result of calling this metafunction class is its argument, <code class="computeroutput"><span class="identifier">T</span></code>. Note that the <code class="computeroutput"><span class="identifier">identity</span></code>
metafunction class is also a <a class="link" href="reference.html#metaprogramming_value">template
metaprogramming value</a>, so it can be an argument or the result of
a template metafunction.
</p>
<p>
To call this metafunction, one has to call the nested template metafunction.
For example:
</p>
<pre class="programlisting"><span class="identifier">identity</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
</pre>
<p>
The above example calls the metafunction class <code class="computeroutput"><span class="identifier">identity</span></code>
with <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;</span></code> as its argument.
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.template_metafunction"></a><a name="metafunction"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.template_metafunction" title="Template metafunction">Template
metafunction</a>
</h4></div></div></div>
<p>
A <span class="emphasis"><em>template metafunction</em></span> represents a function over
types that is evaluated at compile-time. It is implemented by a template
class.
</p>
<p>
The template arguments of that class are expected to be types (<code class="computeroutput"><span class="keyword">class</span></code> or <code class="computeroutput"><span class="keyword">typename</span></code>
template arguments). They represent the arguments of the metafunction.
</p>
<p>
Instances of the template class are expected to have a public nested type
called <code class="computeroutput"><span class="identifier">type</span></code>. This type
is the type the metafunction returns.
</p>
<p>
Template metafunction are expected to be called with <a class="link" href="reference.html#metaprogramming_value">template
metaprogramming values</a> as arguments only.
</p>
<p>
Template metafunctions are expected to return template metaprogramming
values.
</p>
<p>
For example this is the identity template metafunction:
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">identity</span>
<span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span> <span class="identifier">T</span><span class="special">;</span>
<span class="special">};</span>
</pre>
<p>
This metafunction is called <code class="computeroutput"><span class="identifier">identity</span></code>.
It takes one argument, <code class="computeroutput"><span class="identifier">T</span></code>.
The result of calling this metafunction is its argument, <code class="computeroutput"><span class="identifier">T</span></code>.
</p>
<p>
To call this metafunction, one has to instantiate the template class. The
template arguments it is instantiated with are the arguments the metafunction
is called with. For example:
</p>
<pre class="programlisting"><span class="identifier">identity</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
</pre>
<p>
The above example calls the metafunction <code class="computeroutput"><span class="identifier">identity</span></code>
with <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;</span></code> as its argument.
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.template_metaprogramming_value"></a><a name="metaprogramming_value"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.template_metaprogramming_value" title="Template metaprogramming value">Template
metaprogramming value</a>
</h4></div></div></div>
<p>
A <span class="emphasis"><em>template metaprogramming value</em></span> is a <a class="link" href="reference.html#nullary_metafunction">nullary
template metafunction</a> returning itself. For example:
</p>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">void_</span>
<span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span> <span class="identifier">void_</span><span class="special">;</span>
<span class="special">};</span>
</pre>
<p>
This template metaprogramming value is called <code class="computeroutput"><span class="identifier">void_</span></code>.
It is a nullary metafunction returning itself as its result. Because of
this, it can be treated as a nullary metafunction and evaluated any number
of times. For example <code class="computeroutput"><span class="identifier">void_</span><span class="special">::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">type</span></code>
is still <code class="computeroutput"><span class="identifier">void_</span></code>.
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.middle_of"></a><a name="middle_of"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.middle_of" title="middle_of">middle_of</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.middle_of.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.middle_of.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.middle_of.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">P2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">P3</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">middle_of</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.middle_of.arguments"></a><p class="title"><b>Table 24.59. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P1</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P2</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P3</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.middle_of.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.middle_of.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.middle_of.description">Description</a>
</h2>
<p>
<code class="computeroutput"><span class="identifier">middle_of</span></code> applies <code class="computeroutput"><span class="identifier">P1</span></code>, <code class="computeroutput"><span class="identifier">P2</span></code>
and <code class="computeroutput"><span class="identifier">P3</span></code> in sequence. It
accepts an input when all of these three parsers accept it. The result
of parsing is the result of <code class="computeroutput"><span class="identifier">P2</span></code>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.middle_of.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.middle_of.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.middle_of.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">middle_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.middle_of.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.middle_of.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.middle_of.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p1</span></code>, <code class="computeroutput"><span class="identifier">p2</span></code> and <code class="computeroutput"><span class="identifier">p3</span></code>
parsers
</p>
<pre class="programlisting"><span class="identifier">middle_of</span><span class="special">&lt;</span><span class="identifier">p1</span><span class="special">,</span> <span class="identifier">p2</span><span class="special">,</span> <span class="identifier">p3</span><span class="special">&gt;</span>
</pre>
<p>
is equivalent to
</p>
<pre class="programlisting"><span class="identifier">nth_of</span><span class="special">&lt;</span><span class="number">1</span><span class="special">,</span> <span class="identifier">p1</span><span class="special">,</span> <span class="identifier">p2</span><span class="special">,</span> <span class="identifier">p3</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.middle_of.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.middle_of.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.middle_of.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">middle_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">token</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">left_paren_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'('</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">right_paren_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">')'</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">int_in_parens</span> <span class="special">=</span> <span class="identifier">middle_of</span><span class="special">&lt;</span><span class="identifier">left_paren_token</span><span class="special">,</span> <span class="identifier">int_token</span><span class="special">,</span> <span class="identifier">right_paren_token</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">int_in_parens</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"(13)"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">13</span><span class="special">,</span>
<span class="string">"it should return the result of the middle parser"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">int_in_parens</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"13"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should reject the input when there are no parens"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">int_in_parens</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"(13"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should reject the input when there is no closing paren"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.next_char"></a><a name="next_char"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.next_char" title="next_char">next_char</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.next_char.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.next_char.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.next_char.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">SourcePosition</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Ch</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">next_char</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#lazy_metafunction">lazy template metafunction</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.next_char.arguments"></a><p class="title"><b>Table 24.60. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">SourcePosition</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#source_position">source position</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Ch</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#boxed_value">boxed</a> character value. The
character <code class="computeroutput"><span class="identifier">SourcePosition</span></code>
points to in the input.
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.next_char.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.next_char.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.next_char.description">Description</a>
</h2>
<p>
Returns a new source position, pointing to the next character of the same
line.
</p>
<h2>
<a name="metaparse.reference.alphabetical.next_char.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.next_char.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.next_char.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">next_char</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.next_char.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.next_char.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.next_char.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">s</span></code> source position
and <code class="computeroutput"><span class="identifier">c</span></code> wrapped character
the following are equivalent
</p>
<pre class="programlisting"><span class="identifier">get_col</span><span class="special">&lt;</span><span class="identifier">next_char</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">c</span><span class="special">&gt;&gt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">plus</span><span class="special">&lt;</span><span class="identifier">get_col</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">1</span><span class="special">&gt;&gt;</span>
<span class="identifier">get_line</span><span class="special">&lt;</span><span class="identifier">next_char</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">c</span><span class="special">&gt;&gt;</span>
<span class="identifier">get_line</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">&gt;</span>
<span class="identifier">get_prev_char</span><span class="special">&lt;</span><span class="identifier">next_char</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">c</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="identifier">c</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.next_char.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.next_char.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.next_char.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">next_char</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">source_position</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_col</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_line</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_prev_char</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">struct</span> <span class="identifier">returns_source_position</span>
<span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span>
<span class="identifier">source_position</span><span class="special">&lt;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">11</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'a'</span><span class="special">&gt;</span>
<span class="special">&gt;;</span>
<span class="special">};</span>
<span class="keyword">struct</span> <span class="identifier">returns_char</span>
<span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'x'</span><span class="special">&gt;;</span>
<span class="special">};</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_col</span><span class="special">&lt;</span>
<span class="identifier">next_char</span><span class="special">&lt;</span>
<span class="identifier">source_position</span><span class="special">&lt;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">11</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'a'</span><span class="special">&gt;</span>
<span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'x'</span><span class="special">&gt;</span>
<span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">14</span><span class="special">,</span>
<span class="string">"it should increase the column component of the source position"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_line</span><span class="special">&lt;</span>
<span class="identifier">next_char</span><span class="special">&lt;</span>
<span class="identifier">source_position</span><span class="special">&lt;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">11</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'a'</span><span class="special">&gt;</span>
<span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'x'</span><span class="special">&gt;</span>
<span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">11</span><span class="special">,</span>
<span class="string">"it should not increase the line component of the source position"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_prev_char</span><span class="special">&lt;</span>
<span class="identifier">next_char</span><span class="special">&lt;</span>
<span class="identifier">source_position</span><span class="special">&lt;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">11</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'a'</span><span class="special">&gt;</span>
<span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'x'</span><span class="special">&gt;</span>
<span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="char">'x'</span><span class="special">,</span>
<span class="string">"it should update the prev char component of the source position"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_col</span><span class="special">&lt;</span><span class="identifier">next_char</span><span class="special">&lt;</span><span class="identifier">returns_source_position</span><span class="special">,</span> <span class="identifier">returns_char</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">14</span><span class="special">,</span>
<span class="string">"it should support lazy evaluation"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.next_line"></a><a name="next_line"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.next_line" title="next_line">next_line</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.next_line.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.next_line.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.next_line.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">SourcePosition</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Ch</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">next_line</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#lazy_metafunction">lazy template metafunction</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.next_line.arguments"></a><p class="title"><b>Table 24.61. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">SourcePosition</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#source_position">source position</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Ch</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#boxed_value">boxed</a> character value. The
character <code class="computeroutput"><span class="identifier">SourcePosition</span></code>
points to in the input.
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.next_line.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.next_line.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.next_line.description">Description</a>
</h2>
<p>
Returns a new source position, pointing to the beginning of the next line.
</p>
<h2>
<a name="metaparse.reference.alphabetical.next_line.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.next_line.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.next_line.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">next_line</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.next_line.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.next_line.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.next_line.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">s</span></code> source position
and <code class="computeroutput"><span class="identifier">c</span></code> wrapped character
the following are equivalent
</p>
<pre class="programlisting"><span class="identifier">get_col</span><span class="special">&lt;</span><span class="identifier">next_line</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">c</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">1</span><span class="special">&gt;</span>
<span class="identifier">get_line</span><span class="special">&lt;</span><span class="identifier">next_line</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">c</span><span class="special">&gt;&gt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">plus</span><span class="special">&lt;</span><span class="identifier">get_line</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">1</span><span class="special">&gt;&gt;</span>
<span class="identifier">get_prev_char</span><span class="special">&lt;</span><span class="identifier">next_line</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">c</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="identifier">c</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.next_line.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.next_line.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.next_line.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">next_line</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">source_position</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_col</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_line</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_prev_char</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">struct</span> <span class="identifier">returns_source_position</span>
<span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span>
<span class="identifier">source_position</span><span class="special">&lt;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">11</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'a'</span><span class="special">&gt;</span>
<span class="special">&gt;;</span>
<span class="special">};</span>
<span class="keyword">struct</span> <span class="identifier">returns_char</span>
<span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'\n'</span><span class="special">&gt;;</span>
<span class="special">};</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_col</span><span class="special">&lt;</span>
<span class="identifier">next_line</span><span class="special">&lt;</span>
<span class="identifier">source_position</span><span class="special">&lt;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">11</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'a'</span><span class="special">&gt;</span>
<span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'\n'</span><span class="special">&gt;</span>
<span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">1</span><span class="special">,</span>
<span class="string">"it should set the column to 1"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_line</span><span class="special">&lt;</span>
<span class="identifier">next_line</span><span class="special">&lt;</span>
<span class="identifier">source_position</span><span class="special">&lt;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">11</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'a'</span><span class="special">&gt;</span>
<span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'\n'</span><span class="special">&gt;</span>
<span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">12</span><span class="special">,</span>
<span class="string">"it should increase the line component of the source position"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_prev_char</span><span class="special">&lt;</span>
<span class="identifier">next_line</span><span class="special">&lt;</span>
<span class="identifier">source_position</span><span class="special">&lt;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">11</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'a'</span><span class="special">&gt;</span>
<span class="special">&gt;,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'\n'</span><span class="special">&gt;</span>
<span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="char">'\n'</span><span class="special">,</span>
<span class="string">"it should update the prev char component of the source position"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_col</span><span class="special">&lt;</span><span class="identifier">next_line</span><span class="special">&lt;</span><span class="identifier">returns_source_position</span><span class="special">,</span> <span class="identifier">returns_char</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">1</span><span class="special">,</span>
<span class="string">"it should support lazy evaluation"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.none_of_the_expected_cases_found"></a><a name="none_of_the_expected_cases_found"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.none_of_the_expected_cases_found" title="none_of_the_expected_cases_found">none_of_the_expected_cases_found</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.none_of_the_expected_cases_found.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.none_of_the_expected_cases_found.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.none_of_the_expected_cases_found.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">error</span>
<span class="special">{</span>
<span class="keyword">struct</span> <span class="identifier">none_of_the_expected_cases_found</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parsing_error_message">parsing error message</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.none_of_the_expected_cases_found.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.none_of_the_expected_cases_found.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.none_of_the_expected_cases_found.description">Description</a>
</h2>
<p>
Class representing the error that none of a list of parsers could parse
the input.
</p>
<h2>
<a name="metaparse.reference.alphabetical.none_of_the_expected_cases_found.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.none_of_the_expected_cases_found.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.none_of_the_expected_cases_found.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">error</span><span class="special">/</span><span class="identifier">none_of_the_expected_cases_found</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.nth_of_c"></a><a name="nth_of_c"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.nth_of_c" title="nth_of_c">nth_of_c</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.nth_of_c.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.nth_of_c.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.nth_of_c.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">int</span> <span class="identifier">N</span><span class="special">,</span> <span class="keyword">class</span><span class="special">...</span> <span class="identifier">Ps</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">nth_of_c</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.nth_of_c.arguments"></a><p class="title"><b>Table 24.62. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">N</span></code>
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="keyword">int</span></code> value in the
range <code class="computeroutput"><span class="special">[</span><span class="number">0.</span><span class="special">.</span><span class="keyword">sizeof</span><span class="special">...(</span><span class="identifier">Ps</span><span class="special">)]</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Ps</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>s
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.nth_of_c.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.nth_of_c.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.nth_of_c.description">Description</a>
</h2>
<p>
<code class="computeroutput"><span class="identifier">nth_of_c</span></code> applies the <code class="computeroutput"><span class="identifier">Ps</span><span class="special">...</span></code>
parsers in sequence. It accepts an input when all of these parsers accept
it. The result of parsing is the result of the <code class="computeroutput"><span class="identifier">N</span></code>.
parser.
</p>
<p>
On compilers, which are not C++11-compliant, the maximum number of parsers
<code class="computeroutput"><span class="identifier">nth_of_c</span></code> accepts can be
specified with the <code class="computeroutput"><span class="identifier">BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE</span></code>
macro. Its default value is <code class="computeroutput"><span class="number">5</span></code>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.nth_of_c.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.nth_of_c.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.nth_of_c.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">nth_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.nth_of_c.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.nth_of_c.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.nth_of_c.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p0</span></code>, ..., <code class="computeroutput"><span class="identifier">pn</span></code> parsers and <code class="computeroutput"><span class="identifier">k</span></code>
integer value, where <code class="computeroutput"><span class="number">0</span> <span class="special">&lt;=</span>
<span class="identifier">k</span> <span class="special">&lt;</span>
<span class="identifier">n</span></code> the following are equivalent
</p>
<pre class="programlisting"><span class="identifier">nth_of_c</span><span class="special">&lt;</span><span class="identifier">k</span><span class="special">,</span> <span class="identifier">p0</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">pn</span><span class="special">&gt;</span>
<span class="identifier">transform</span><span class="special">&lt;</span><span class="identifier">sequence</span><span class="special">&lt;</span><span class="identifier">p0</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">pn</span><span class="special">&gt;,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">at_c</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_1</span><span class="special">,</span> <span class="identifier">k</span><span class="special">&gt;&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.nth_of_c.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.nth_of_c.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.nth_of_c.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">nth_of_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">token</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">left_paren_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'('</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">right_paren_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">')'</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">int_in_parens</span> <span class="special">=</span>
<span class="identifier">nth_of_c</span><span class="special">&lt;</span><span class="number">1</span><span class="special">,</span> <span class="identifier">left_paren_token</span><span class="special">,</span> <span class="identifier">int_token</span><span class="special">,</span> <span class="identifier">right_paren_token</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">int_in_parens</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"(13)"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">13</span><span class="special">,</span>
<span class="string">"it should return the result of the second parser"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">int_in_parens</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"13"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should reject the input when there are no parens"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">int_in_parens</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"(13"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should reject the input when there is no closing paren"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.nth_of"></a><a name="nth_of"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.nth_of" title="nth_of">nth_of</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.nth_of.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.nth_of.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.nth_of.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">N</span><span class="special">,</span> <span class="keyword">class</span><span class="special">...</span> <span class="identifier">Ps</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">nth_of</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.nth_of.arguments"></a><p class="title"><b>Table 24.63. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">N</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#boxed_value">boxed</a> integer value in the
range <code class="computeroutput"><span class="special">[</span><span class="number">0.</span><span class="special">.</span><span class="keyword">sizeof</span><span class="special">...(</span><span class="identifier">Ps</span><span class="special">)]</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Ps</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>s
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.nth_of.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.nth_of.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.nth_of.description">Description</a>
</h2>
<p>
<code class="computeroutput"><span class="identifier">nth_of</span></code> applies the <code class="computeroutput"><span class="identifier">Ps</span><span class="special">...</span></code>
parsers in sequence. It accepts an input when all of these parsers accept
it. The result of parsing is the result of the <code class="computeroutput"><span class="identifier">N</span></code>.
parser.
</p>
<p>
On compilers, which are not C++11-compliant, the maximum number of parsers
<code class="computeroutput"><span class="identifier">nth_of</span></code> accepts can be specified
with the <code class="computeroutput"><span class="identifier">BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE</span></code>
macro. Its default value is <code class="computeroutput"><span class="number">5</span></code>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.nth_of.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.nth_of.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.nth_of.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">nth_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.nth_of.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.nth_of.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.nth_of.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p0</span></code>, ..., <code class="computeroutput"><span class="identifier">pn</span></code> parsers and <code class="computeroutput"><span class="identifier">k</span></code>
boxed integer value the following are equivalent
</p>
<pre class="programlisting"><span class="identifier">nth_of</span><span class="special">&lt;</span><span class="identifier">k</span><span class="special">,</span> <span class="identifier">p0</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">pn</span><span class="special">&gt;</span>
<span class="identifier">nth_of_c</span><span class="special">&lt;</span><span class="identifier">k</span><span class="special">::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span> <span class="identifier">p0</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">pn</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.nth_of.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.nth_of.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.nth_of.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">nth_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">token</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">left_paren_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'('</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">right_paren_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">')'</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">int_in_parens</span> <span class="special">=</span>
<span class="identifier">nth_of</span><span class="special">&lt;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">1</span><span class="special">&gt;,</span>
<span class="identifier">left_paren_token</span><span class="special">,</span> <span class="identifier">int_token</span><span class="special">,</span> <span class="identifier">right_paren_token</span>
<span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">int_in_parens</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"(13)"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">13</span><span class="special">,</span>
<span class="string">"it should return the result of the second parser"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">int_in_parens</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"13"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should reject the input when there are no parens"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">int_in_parens</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"(13"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should reject the input when there is no closing paren"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.nullary_template_metafunction"></a><a name="nullary_metafunction"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.nullary_template_metafunction" title="Nullary template metafunction">Nullary
template metafunction</a>
</h4></div></div></div>
<p>
A <span class="emphasis"><em>nullary template metafuncion</em></span> is a <a class="link" href="reference.html#metafunction">template
metafunction</a> taking 0 arguments. It is a type with a nested type
called <code class="computeroutput"><span class="identifier">type</span></code>, which is the
return value of the nullary metafunction. For example:
</p>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">always13</span>
<span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;;</span>
<span class="special">};</span>
</pre>
<p>
This metafunction is called <code class="computeroutput"><span class="identifier">always13</span></code>.
It is a nullary metafunction, because it takes no arguments. It always
returns <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;</span></code>.
</p>
<p>
To call this metafunction, one has to access its <code class="computeroutput"><span class="special">::</span><span class="identifier">type</span></code>. For example:
</p>
<pre class="programlisting"><span class="identifier">always13</span><span class="special">::</span><span class="identifier">type</span>
</pre>
<p>
The above example calls the metafunction to get <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;</span></code>.
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.one_char_except_c"></a><a name="one_char_except_c"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.one_char_except_c" title="one_char_except_c">one_char_except_c</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.one_char_except_c.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.one_char_except_c.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.one_char_except_c.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">char</span><span class="special">...</span> <span class="identifier">Cs</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">one_char_except_c</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser">parser</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.one_char_except_c.arguments"></a><p class="title"><b>Table 24.64. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Cs</span></code>
</p>
</td>
<td>
<p>
character values
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.one_char_except_c.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.one_char_except_c.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.one_char_except_c.description">Description</a>
</h2>
<p>
<code class="computeroutput"><span class="identifier">one_char_except_c</span></code> accepts
one character except any of <code class="computeroutput"><span class="identifier">Cs</span></code>.
When the input is empty or begins with one of the non-accepted characters,
<code class="computeroutput"><span class="identifier">one_char_except_c</span></code> rejects
the input. Otherwise it accepts the input and the result of parsing is
the character value.
</p>
<p>
On compilers, which are not C++11-compliant, the maximum number of characters
this class can have is the value the macro <code class="computeroutput"><span class="identifier">BOOST_METAPARSE_LIMIT_ONE_CHAR_EXCEPT_SIZE</span></code>
expands to. Its default value is 10.
</p>
<h2>
<a name="metaparse.reference.alphabetical.one_char_except_c.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.one_char_except_c.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.one_char_except_c.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">one_char_except_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.one_char_except_c.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.one_char_except_c.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.one_char_except_c.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">s</span></code> compile-time
string and <code class="computeroutput"><span class="identifier">c1</span></code>, ..., <code class="computeroutput"><span class="identifier">cn</span></code> characters the following are equivalent
</p>
<pre class="programlisting"><span class="identifier">one_char_except_c</span><span class="special">&lt;</span><span class="identifier">c1</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">cn</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">::</span><span class="identifier">one_char</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<p>
when <code class="computeroutput"><span class="identifier">s</span></code> is empty or it begins
with a character other than <code class="computeroutput"><span class="identifier">c1</span></code>,
..., <code class="computeroutput"><span class="identifier">cn</span></code>. Otherwise <code class="computeroutput"><span class="identifier">one_char_except_c</span><span class="special">&lt;</span><span class="identifier">c1</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">cn</span><span class="special">&gt;::</span><span class="identifier">appl</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span></code> returns a parsing error.
</p>
<h2>
<a name="metaparse.reference.alphabetical.one_char_except_c.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.one_char_except_c.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.one_char_except_c.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">one_char_except_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">middle_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">repeated</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">vector</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="keyword">char</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">equal</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">string_literal_parser</span> <span class="special">=</span>
<span class="identifier">middle_of</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'"'</span><span class="special">&gt;,</span> <span class="identifier">repeated</span><span class="special">&lt;</span><span class="identifier">one_char_except_c</span><span class="special">&lt;</span><span class="char">'"'</span><span class="special">&gt;&gt;,</span> <span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'"'</span><span class="special">&gt;&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">equal</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'h'</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'e'</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'l'</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'l'</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'o'</span><span class="special">&gt;</span>
<span class="special">&gt;,</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">string_literal_parser</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"\"hello\""</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should return the content of the string literal"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.one_char_except"></a><a name="one_char_except"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.one_char_except" title="one_char_except">one_char_except</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.one_char_except.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.one_char_except.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.one_char_except.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span><span class="special">...</span> <span class="identifier">Cs</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">one_char_except</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser">parser</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.one_char_except.arguments"></a><p class="title"><b>Table 24.65. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Cs</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#boxed_value">boxed</a> character values
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.one_char_except.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.one_char_except.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.one_char_except.description">Description</a>
</h2>
<p>
<code class="computeroutput"><span class="identifier">one_char_except</span></code> accepts
one character except any of <code class="computeroutput"><span class="identifier">Cs</span></code>.
When the input is empty or begins with one of the non-accepted characters,
<code class="computeroutput"><span class="identifier">one_char_except</span></code> rejects
the input. Otherwise it accepts the input and the result of parsing is
the character value.
</p>
<p>
On compilers, which are not C++11-compliant, the maximum number of characters
this class can have is the value the macro <code class="computeroutput"><span class="identifier">BOOST_METAPARSE_LIMIT_ONE_CHAR_EXCEPT_SIZE</span></code>
expands to. Its default value is 10.
</p>
<h2>
<a name="metaparse.reference.alphabetical.one_char_except.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.one_char_except.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.one_char_except.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">one_char_except</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.one_char_except.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.one_char_except.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.one_char_except.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">c1</span></code>, ..., <code class="computeroutput"><span class="identifier">cn</span></code> boxed characters the following are
equivalent
</p>
<pre class="programlisting"><span class="identifier">one_char_except</span><span class="special">&lt;</span><span class="identifier">c1</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">cn</span><span class="special">&gt;</span>
<span class="identifier">one_char_except_c</span><span class="special">&lt;</span><span class="identifier">c1</span><span class="special">::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">cn</span><span class="special">::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.one_char_except.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.one_char_except.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.one_char_except.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">one_char_except</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">middle_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">repeated</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">vector</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="keyword">char</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">equal</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">string_literal_parser</span> <span class="special">=</span>
<span class="identifier">middle_of</span><span class="special">&lt;</span>
<span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'"'</span><span class="special">&gt;,</span>
<span class="identifier">repeated</span><span class="special">&lt;</span><span class="identifier">one_char_except</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'"'</span><span class="special">&gt;&gt;&gt;,</span>
<span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'"'</span><span class="special">&gt;</span>
<span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">equal</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'h'</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'e'</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'l'</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'l'</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'o'</span><span class="special">&gt;</span>
<span class="special">&gt;,</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">string_literal_parser</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"\"hello\""</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should return the content of the string literal"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.one_char"></a><a name="one_char"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.one_char" title="one_char">one_char</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.one_char.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.one_char.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.one_char.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">one_char</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser">parser</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.one_char.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.one_char.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.one_char.description">Description</a>
</h2>
<p>
<code class="computeroutput"><span class="identifier">one_char</span></code> accepts one character.
The result of parsing is the accepted character. It fails for empty input.
</p>
<h2>
<a name="metaparse.reference.alphabetical.one_char.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.one_char.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.one_char.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">one_char</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.one_char.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.one_char.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.one_char.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">s</span></code> non-empty compile-time
string and <code class="computeroutput"><span class="identifier">pos</span></code> source position
the following are equivalent
</p>
<pre class="programlisting"><span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">one_char</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">front</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">&gt;</span>
<span class="identifier">get_remaining</span><span class="special">&lt;</span><span class="identifier">one_char</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">pop_front</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">&gt;</span>
</pre>
<p>
The value of <code class="computeroutput"><span class="identifier">get_position</span><span class="special">&lt;</span><span class="identifier">one_char</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;</span></code> depends on the first character
of the sequence and the value of the one parsed before that (which is stored
in the source position). <code class="computeroutput"><span class="identifier">one_char</span></code>
updates the source position's <code class="computeroutput"><span class="identifier">col</span></code>
and <code class="computeroutput"><span class="identifier">line</span></code> values based on
the new line characters. It detects Linux (<code class="computeroutput"><span class="special">\</span><span class="identifier">n</span></code>), Windows (<code class="computeroutput"><span class="special">\</span><span class="identifier">r</span><span class="special">\</span><span class="identifier">n</span></code>)
and Mac (<code class="computeroutput"><span class="special">\</span><span class="identifier">r</span></code>)
line endings.
</p>
<p>
<code class="computeroutput"><span class="identifier">one_char</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">""</span><span class="special">),</span>
<span class="identifier">pos</span><span class="special">&gt;</span></code>
returns an error for every <code class="computeroutput"><span class="identifier">pos</span></code>
source position.
</p>
<h2>
<a name="metaparse.reference.alphabetical.one_char.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.one_char.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.one_char.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">one_char</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_remaining</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">one_char</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"foo"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="char">'f'</span><span class="special">,</span>
<span class="string">"the result of parsing should be the first character of the input"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
<span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"oo"</span><span class="special">),</span>
<span class="identifier">get_remaining</span><span class="special">&lt;</span><span class="identifier">one_char</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"foo"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"one_char should consume the first character of the input"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">one_char</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">""</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should return an error for empty input"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.one_of_c"></a><a name="one_of_c"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.one_of_c" title="one_of_c">one_of_c</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.one_of_c.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.one_of_c.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.one_of_c.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">char</span><span class="special">...</span> <span class="identifier">Cs</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">one_of_c</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser">parser</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.one_of_c.arguments"></a><p class="title"><b>Table 24.66. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Cs</span></code>
</p>
</td>
<td>
<p>
character values
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.one_of_c.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.one_of_c.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.one_of_c.description">Description</a>
</h2>
<p>
It accepts inputs beginning with any of the <code class="computeroutput"><span class="identifier">Cs</span><span class="special">...</span></code> characters. The result of parsing is
the first character of the input.
</p>
<p>
On compilers, which are not C++11-compliant, the maximum number of characters
that can be provided is defined by the <code class="computeroutput"><span class="identifier">BOOST_METAPARSE_LIMIT_ONE_OF_SIZE</span></code>
macro. Its default value is <code class="computeroutput"><span class="number">20</span></code>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.one_of_c.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.one_of_c.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.one_of_c.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">one_of_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.one_of_c.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.one_of_c.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.one_of_c.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">c1</span></code>, ..., <code class="computeroutput"><span class="identifier">cn</span></code> characters
</p>
<pre class="programlisting"><span class="identifier">one_of_c</span><span class="special">&lt;</span><span class="identifier">c1</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">cn</span><span class="special">&gt;</span>
</pre>
<p>
is equivalent to
</p>
<pre class="programlisting"><span class="identifier">one_of</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="identifier">c1</span><span class="special">&gt;,</span> <span class="comment">/* ... */</span><span class="special">,</span> <span class="identifier">lit_c</span><span class="special">&lt;</span><span class="identifier">cn</span><span class="special">&gt;&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.one_of_c.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.one_of_c.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.one_of_c.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">one_of_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">whitespace</span> <span class="special">=</span> <span class="identifier">one_of_c</span><span class="special">&lt;</span><span class="char">' '</span><span class="special">,</span> <span class="char">'\n'</span><span class="special">,</span> <span class="char">'\r'</span><span class="special">,</span> <span class="char">'\t'</span><span class="special">,</span> <span class="char">'\v'</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">whitespace</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">" "</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="char">' '</span><span class="special">,</span>
<span class="string">"the result of parsing should be the first character of the input"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">whitespace</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"x"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should return an error when the input does not begin with a whitespace"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.one_of"></a><a name="one_of"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.one_of" title="one_of">one_of</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.one_of.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.one_of.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.one_of.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span><span class="special">...</span> <span class="identifier">Ps</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">one_of</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.one_of.arguments"></a><p class="title"><b>Table 24.67. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Ps</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>s
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.one_of.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.one_of.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.one_of.description">Description</a>
</h2>
<p>
It accepts an input when any of the <code class="computeroutput"><span class="identifier">Ps</span><span class="special">...</span></code> parsers accept it. The result of parsing
is the result of applying the first parser that accepts the input. The
parsers are tried in order, therefore in case of ambiguous grammars the
result of parsing depends on the order of the <code class="computeroutput"><span class="identifier">Ps</span><span class="special">...</span></code> parsers.
</p>
<p>
On compilers, which are not C++11-compliant, the maximum number of accepted
parsers is defined by the <code class="computeroutput"><span class="identifier">BOOST_METAPARSE_LIMIT_ONE_OF_SIZE</span></code>
macro. Its default value is <code class="computeroutput"><span class="number">20</span></code>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.one_of.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.one_of.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.one_of.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">one_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.one_of.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.one_of.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.one_of.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p1</span></code>, ..., <code class="computeroutput"><span class="identifier">pn</span></code> parsers, <code class="computeroutput"><span class="identifier">s</span></code>
compile-time string and <code class="computeroutput"><span class="identifier">pos</span></code>
source position
</p>
<pre class="programlisting"><span class="identifier">one_of</span><span class="special">&lt;</span><span class="identifier">p1</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">pn</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<p>
is equivalent to
</p>
<pre class="programlisting"><span class="identifier">pk</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<p>
when there is a <code class="computeroutput"><span class="identifier">k</span></code>, that
<code class="computeroutput"><span class="identifier">pi</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
returns an error for every <code class="computeroutput"><span class="identifier">i</span></code>
in the range <code class="computeroutput"><span class="special">[</span><span class="number">1.</span><span class="special">.</span><span class="identifier">k</span><span class="special">)</span></code>
and <code class="computeroutput"><span class="identifier">pk</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
doesn't return an error.
</p>
<p>
The parser combinator returns an error when there is no such <code class="computeroutput"><span class="identifier">k</span></code>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.one_of.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.one_of.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.one_of.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">one_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">whitespace</span> <span class="special">=</span>
<span class="identifier">one_of</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">' '</span><span class="special">&gt;,</span> <span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'\n'</span><span class="special">&gt;,</span> <span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'\r'</span><span class="special">&gt;,</span> <span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'\t'</span><span class="special">&gt;,</span> <span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'\v'</span><span class="special">&gt;&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">whitespace</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">" "</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="char">' '</span><span class="special">,</span>
<span class="string">"the result of parsing should be the first character of the input"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">whitespace</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"x"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should return an error when the input does not begin with a whitespace"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.optional"></a><a name="optional"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.optional" title="optional">optional</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.optional.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.optional.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.optional.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Default</span> <span class="special">=</span> <span class="comment">/* unspecified */</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">optional</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.optional.arguments"></a><p class="title"><b>Table 24.68. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Default</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a>
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.optional.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.optional.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.optional.description">Description</a>
</h2>
<p>
It tries parsing the input with <code class="computeroutput"><span class="identifier">P</span></code>.
When <code class="computeroutput"><span class="identifier">P</span></code> succeeds, the result
of parsing is the result of <code class="computeroutput"><span class="identifier">P</span></code>.
Otherwise no characters are consumed and the result of parsing is <code class="computeroutput"><span class="identifier">Default</span></code>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.optional.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.optional.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.optional.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">optional</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.optional.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.optional.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.optional.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> <a class="link" href="reference.html#parser">parser</a>
and <code class="computeroutput"><span class="identifier">d</span></code> <a class="link" href="reference.html#metaprogramming_value">template
metaprogramming value</a>
</p>
<pre class="programlisting"><span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">d</span><span class="special">&gt;</span>
</pre>
<p>
is equivalent to
</p>
<pre class="programlisting"><span class="identifier">one_of</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">return_</span><span class="special">&lt;</span><span class="identifier">d</span><span class="special">&gt;&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.optional.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.optional.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.optional.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">optional</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">middle_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">sequence</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="keyword">int</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">equal</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">equal_to</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">vector_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">complex_number</span> <span class="special">=</span>
<span class="identifier">sequence</span><span class="special">&lt;</span>
<span class="comment">// Real</span>
<span class="identifier">int_</span><span class="special">,</span>
<span class="comment">// Imaginary</span>
<span class="identifier">optional</span><span class="special">&lt;</span>
<span class="identifier">middle_of</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'+'</span><span class="special">&gt;,</span> <span class="identifier">int_</span><span class="special">,</span> <span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'i'</span><span class="special">&gt;&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;</span>
<span class="special">&gt;</span>
<span class="special">&gt;</span>
<span class="special">;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">equal</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">vector_c</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">1</span><span class="special">,</span> <span class="number">0</span><span class="special">&gt;,</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">complex_number</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"1"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">equal_to</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"No imaginary"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">equal</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">vector_c</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">1</span><span class="special">,</span> <span class="number">0</span><span class="special">&gt;,</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">complex_number</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"1+0i"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">equal_to</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"0 as imaginary"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">equal</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">vector_c</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">0</span><span class="special">,</span> <span class="number">1</span><span class="special">&gt;,</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">complex_number</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"0+1i"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">equal_to</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"Non-null imaginary"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.parser_combinator"></a><a name="parser_combinator"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.parser_combinator" title="Parser combinator">Parser
combinator</a>
</h4></div></div></div>
<p>
A <span class="emphasis"><em>parser combinator</em></span> is a <a class="link" href="reference.html#parser">parser</a>
implemented as a template class taking one or more parsers as arguments.
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.parser"></a><a name="parser"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.parser" title="Parser">Parser</a>
</h4></div></div></div>
<p>
A <span class="emphasis"><em>parser</em></span> is a <a class="link" href="reference.html#metafunction_class">template
metafunction class</a> that takes the following arguments:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
a suffix of the input text, a <a class="link" href="reference.html#string"><code class="computeroutput"><span class="identifier">string</span></code></a>
</li>
<li class="listitem">
a <a class="link" href="reference.html#source_position">source position</a> describing
at which position of the entire input text the suffix begins at
</li>
</ul></div>
<p>
The function parses a prefix of the input string. When the parsing is successful,
it returns an <a class="link" href="reference.html#accept"><code class="computeroutput"><span class="identifier">accept</span></code></a>
value. When there is a parsing error, the parser returns a <a class="link" href="reference.html#reject"><code class="computeroutput"><span class="identifier">reject</span></code></a> value. The <a class="link" href="reference.html#is_error"><code class="computeroutput"><span class="identifier">is_error</span></code></a> metafunction can be used
to determine about the result of a parser if it succeeded or failed.
</p>
<p>
The documentation refers often to the <span class="emphasis"><em>result of a parser</em></span>.
This means that the parser accepts the input and refers to what <a class="link" href="reference.html#get_result"><code class="computeroutput"><span class="identifier">get_result</span></code></a> returns for the value
returned by the parser.
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.parsing_error_message"></a><a name="parsing_error_message"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.parsing_error_message" title="Parsing error message">Parsing
error message</a>
</h4></div></div></div>
<p>
A <span class="emphasis"><em>parsing error message</em></span> is a <a class="link" href="reference.html#metaprogramming_value">template
metaprogramming value</a> with a <code class="computeroutput"><span class="keyword">static</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">get_value</span><span class="special">()</span></code> member function. This function returns
the pretty-printed version of the error the class represents. For example:
</p>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">example_error</span>
<span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span> <span class="identifier">example_error</span><span class="special">;</span>
<span class="keyword">static</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">get_value</span><span class="special">()</span>
<span class="special">{</span>
<span class="keyword">return</span> <span class="string">"This is a formatted example error."</span>
<span class="special">}</span>
<span class="special">};</span>
</pre>
<p>
Failing <a class="link" href="reference.html#parser">parser</a>s return parsing error messages
as error messages.
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.predicate"></a><a name="predicate"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.predicate" title="Predicate">Predicate</a>
</h4></div></div></div>
<p>
A <span class="emphasis"><em>predicate</em></span> (or unary predicate) is a <a class="link" href="reference.html#metafunction_class">template
metafunction class</a> taking one argument and returning a <a class="link" href="reference.html#boxed_value">boxed
value</a> of type <code class="computeroutput"><span class="keyword">bool</span></code>.
</p>
<p>
For example the following predicate checks if its argument is the boxed
<code class="computeroutput"><span class="keyword">char</span></code> value <code class="computeroutput"><span class="identifier">x</span></code>:
</p>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">is_x</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">C</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">apply</span>
<span class="special">{</span>
<span class="keyword">static</span> <span class="keyword">constexpr</span> <span class="keyword">bool</span> <span class="identifier">value</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">C</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="char">'x'</span><span class="special">);</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span> <span class="identifier">apply</span><span class="special">;</span>
<span class="special">};</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span> <span class="identifier">is_x</span><span class="special">;</span>
<span class="special">};</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.range_c"></a><a name="range_c"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.range_c" title="range_c">range_c</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.range_c.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.range_c.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.range_c.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">char</span> <span class="identifier">From</span><span class="special">,</span> <span class="keyword">char</span> <span class="identifier">To</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">range_c</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser">parser</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.range_c.arguments"></a><p class="title"><b>Table 24.69. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">From</span></code>
</p>
</td>
<td>
<p>
character value
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">To</span></code>
</p>
</td>
<td>
<p>
character value
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.range_c.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.range_c.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.range_c.description">Description</a>
</h2>
<p>
<code class="computeroutput"><span class="identifier">range_c</span></code> accepts one character
in the range <code class="computeroutput"><span class="special">[</span><span class="identifier">From</span><span class="special">..</span><span class="identifier">To</span><span class="special">]</span></code>. The result of the parser is the accepted
character.
</p>
<h2>
<a name="metaparse.reference.alphabetical.range_c.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.range_c.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.range_c.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">range_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.range_c.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.range_c.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.range_c.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">A</span></code>, <code class="computeroutput"><span class="identifier">B</span></code> characters the following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">range_c</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span> <span class="identifier">B</span><span class="special">&gt;</span>
<span class="identifier">accept_when</span><span class="special">&lt;</span>
<span class="identifier">one_char</span><span class="special">,</span>
<span class="identifier">util</span><span class="special">::</span><span class="identifier">in_range_c</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="identifier">A</span><span class="special">,</span> <span class="identifier">B</span><span class="special">&gt;,</span>
<span class="identifier">errors</span><span class="special">::</span><span class="identifier">unexpected_character</span>
<span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.range_c.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.range_c.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.range_c.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">range_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">one_digit</span> <span class="special">=</span> <span class="identifier">range_c</span><span class="special">&lt;</span><span class="char">'0'</span><span class="special">,</span> <span class="char">'9'</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">one_digit</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"0"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"one_digit should accept a digit"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">one_digit</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"x"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"one_digit should reject a value outside of ['0'..'9']"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">one_digit</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"0"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="char">'0'</span><span class="special">,</span>
<span class="string">"the result of parsing should be the character value"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.range"></a><a name="range"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.range" title="range">range</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.range.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.range.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.range.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">From</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">To</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">range</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser">parser</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.range.arguments"></a><p class="title"><b>Table 24.70. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">From</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#boxed_value">boxed</a> character value
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">To</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#boxed_value">boxed</a> character value
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.range.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.range.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.range.description">Description</a>
</h2>
<p>
<code class="computeroutput"><span class="identifier">range</span></code> accepts one character
in the range <code class="computeroutput"><span class="special">[</span><span class="identifier">From</span><span class="special">..</span><span class="identifier">To</span><span class="special">]</span></code>. The result of the parser is the accepted
character.
</p>
<h2>
<a name="metaparse.reference.alphabetical.range.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.range.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.range.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">range</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.range.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.range.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.range.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">A</span></code>, <code class="computeroutput"><span class="identifier">B</span></code> wrapped characters the following are
equivalent:
</p>
<pre class="programlisting"><span class="identifier">range</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span> <span class="identifier">B</span><span class="special">&gt;</span>
<span class="identifier">accept_when</span><span class="special">&lt;</span><span class="identifier">one_char</span><span class="special">,</span> <span class="identifier">util</span><span class="special">::</span><span class="identifier">in_range</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span> <span class="identifier">B</span><span class="special">&gt;,</span> <span class="identifier">errors</span><span class="special">::</span><span class="identifier">unexpected_character</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.range.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.range.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.range.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">range</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">one_digit</span> <span class="special">=</span>
<span class="identifier">range</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'0'</span><span class="special">&gt;,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="char">'9'</span><span class="special">&gt;&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">one_digit</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"0"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"one_digit should accept a digit"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">one_digit</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"x"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"one_digit should reject a value outside of ['0'..'9']"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">one_digit</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"0"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="char">'0'</span><span class="special">,</span>
<span class="string">"the result of parsing should be the character value"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.reject"></a><a name="reject"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.reject" title="reject">reject</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.reject.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.reject.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.reject.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Msg</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Pos</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">reject</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.reject.arguments"></a><p class="title"><b>Table 24.71. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Msg</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Pos</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#source_position">source position</a>
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.reject.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.reject.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.reject.description">Description</a>
</h2>
<p>
Values representing a failed parser application. It behaves as a <a class="link" href="reference.html#lazy_metafunction">lazy template metafunction</a>: when it
is evaluated as a metafunction, it returns itself with its arguments evaluated.
See expression semantics for further details.
</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
Note that for backward compatibility when <code class="computeroutput"><span class="identifier">Msg</span><span class="special">::</span><span class="identifier">type</span></code>
is not defined, <code class="computeroutput"><span class="identifier">reject</span><span class="special">&lt;....&gt;::</span><span class="identifier">type</span></code>
does not evaluate <code class="computeroutput"><span class="identifier">Msg</span></code>.
For example <code class="computeroutput"><span class="identifier">reject</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">start</span><span class="special">&gt;::</span><span class="identifier">type</span></code> is <code class="computeroutput"><span class="identifier">reject</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">start</span><span class="special">::</span><span class="identifier">type</span><span class="special">&gt;</span></code>. Using types that are not template
metaprogramming values as <code class="computeroutput"><span class="identifier">Msg</span></code>
is deprecated and will not work in future versions of the library.
</p></td></tr>
</table></div>
<h2>
<a name="metaparse.reference.alphabetical.reject.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.reject.expressions_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.reject.expressions_semantics">Expressions
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">m</span></code> template metaprogramming
value and <code class="computeroutput"><span class="identifier">p</span></code> source position
the following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">reject</span><span class="special">&lt;</span><span class="identifier">m</span><span class="special">,</span> <span class="identifier">p</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="identifier">reject</span><span class="special">&lt;</span><span class="identifier">m</span><span class="special">,</span> <span class="identifier">p</span><span class="special">::</span><span class="identifier">type</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.reject.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.reject.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.reject.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">reject</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.reject.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.reject.operations"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.reject.operations">Operations</a>
</h2>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a class="link" href="reference.html#get_position"><code class="computeroutput"><span class="identifier">get_position</span></code></a>
</li>
<li class="listitem">
<a class="link" href="reference.html#get_message"><code class="computeroutput"><span class="identifier">get_message</span></code></a>
</li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.repeated1"></a><a name="repeated1"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated1" title="repeated1">repeated1</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.repeated1.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated1.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated1.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">repeated1</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.repeated1.arguments"></a><p class="title"><b>Table 24.72. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.repeated1.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated1.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated1.description">Description</a>
</h2>
<p>
It applies <code class="computeroutput"><span class="identifier">P</span></code> on the input
string repeatedly as long as the parser accepts the input. The result of
parsing is a sequence of the results of the individual applications of
<code class="computeroutput"><span class="identifier">P</span></code>.
</p>
<p>
When <code class="computeroutput"><span class="identifier">P</span></code> rejects the input
for the first time, <code class="computeroutput"><span class="identifier">repeated1</span></code>
rejects it as well. At least one successful application of <code class="computeroutput"><span class="identifier">P</span></code> is required for <code class="computeroutput"><span class="identifier">repeated1</span></code>
to accept the input.
</p>
<h2>
<a name="metaparse.reference.alphabetical.repeated1.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated1.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated1.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">repeated1</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.repeated1.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated1.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated1.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser the following
are equivalent:
</p>
<pre class="programlisting"><span class="identifier">repeated1</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">&gt;</span>
<span class="identifier">last_of</span><span class="special">&lt;</span><span class="identifier">look_ahead</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">&gt;,</span> <span class="identifier">repeated</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">&gt;&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.repeated1.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated1.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated1.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">repeated1</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">digit_val</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">equal</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">vector</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="keyword">int</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">digits</span> <span class="special">=</span> <span class="identifier">repeated1</span><span class="special">&lt;</span><span class="identifier">digit_val</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">equal</span><span class="special">&lt;</span>
<span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">digits</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"1234"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">1</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">2</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">3</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">4</span><span class="special">&gt;</span>
<span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"the result of parsing should be the list of digit values"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">digits</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"x"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"repeated1 should reject the input when it can't parse anything with digit_val"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.repeated_reject_incomplete1"></a><a name="repeated_reject_incomplete1"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated_reject_incomplete1" title="repeated_reject_incomplete1">repeated_reject_incomplete1</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.repeated_reject_incomplete1.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated_reject_incomplete1.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated_reject_incomplete1.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">repeated_reject_incomplete1</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.repeated_reject_incomplete1.arguments"></a><p class="title"><b>Table 24.73. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.repeated_reject_incomplete1.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated_reject_incomplete1.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated_reject_incomplete1.description">Description</a>
</h2>
<p>
The same as <a class="link" href="reference.html#repeated1"><code class="computeroutput"><span class="identifier">repeated1</span></code></a>,
but once <code class="computeroutput"><span class="identifier">P</span></code> rejects the
input, <code class="computeroutput"><span class="identifier">repeated_reject_incomplete1</span></code>
checks if <code class="computeroutput"><span class="identifier">P</span></code> consumes any
characters before rejecting the input. If so, <code class="computeroutput"><span class="identifier">repeated_reject_incomplete1</span></code>
rejects the input with the same error message this last application of
<code class="computeroutput"><span class="identifier">P</span></code> returned. Otherwise _reject_incomplete<code class="computeroutput"><span class="identifier">repeated1</span></code> accepts the input and gives
the same result as <a class="link" href="reference.html#repeated1"><code class="computeroutput"><span class="identifier">repeated1</span></code></a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.repeated_reject_incomplete1.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated_reject_incomplete1.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated_reject_incomplete1.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">repeated_reject_incomplete1</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.repeated_reject_incomplete1.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated_reject_incomplete1.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated_reject_incomplete1.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser, <code class="computeroutput"><span class="identifier">s</span></code> compile-time string and <code class="computeroutput"><span class="identifier">pos</span></code> source position
</p>
<pre class="programlisting"><span class="identifier">repeated_reject_incomplete1</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<p>
is equivalent to
</p>
<pre class="programlisting"><span class="identifier">first_of</span><span class="special">&lt;</span><span class="identifier">repeated1</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">&gt;,</span> <span class="identifier">fail_at_first_char_expected</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">&gt;</span> <span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.repeated_reject_incomplete1.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated_reject_incomplete1.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated_reject_incomplete1.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">repeated_reject_incomplete1</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">last_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">token</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">equal</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">vector_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'+'</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_int</span> <span class="special">=</span> <span class="identifier">last_of</span><span class="special">&lt;</span><span class="identifier">plus_token</span><span class="special">,</span> <span class="identifier">int_token</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">ints</span> <span class="special">=</span> <span class="identifier">repeated_reject_incomplete1</span><span class="special">&lt;</span><span class="identifier">plus_int</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">equal</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">vector_c</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">,</span> <span class="number">3</span><span class="special">,</span> <span class="number">21</span><span class="special">&gt;,</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"+ 13 + 3 + 21"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"ints should parse the numbers"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"+ 13 + 3 +"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"when the last number is missing, it should be an error"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">""</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"when no numbers are provided, it should be an error"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.repeated_reject_incomplete"></a><a name="repeated_reject_incomplete"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated_reject_incomplete" title="repeated_reject_incomplete">repeated_reject_incomplete</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.repeated_reject_incomplete.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated_reject_incomplete.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated_reject_incomplete.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">repeated_reject_incomplete</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.repeated_reject_incomplete.arguments"></a><p class="title"><b>Table 24.74. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.repeated_reject_incomplete.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated_reject_incomplete.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated_reject_incomplete.description">Description</a>
</h2>
<p>
The same as <a class="link" href="reference.html#repeated"><code class="computeroutput"><span class="identifier">repeated</span></code></a>,
but once <code class="computeroutput"><span class="identifier">P</span></code> rejects the
input, <code class="computeroutput"><span class="identifier">repeated_reject_incomplete</span></code>
checks if <code class="computeroutput"><span class="identifier">P</span></code> consumes any
characters before rejecting the input. If so, <code class="computeroutput"><span class="identifier">repeated_reject_incomplete</span></code>
rejects the input with the same error message this last application of
<code class="computeroutput"><span class="identifier">P</span></code> returned. Otherwise
<code class="computeroutput"><span class="identifier">repeated_reject_incomplete</span></code>
accepts the input and gives the same result as <a class="link" href="reference.html#repeated"><code class="computeroutput"><span class="identifier">repeated</span></code></a>.
</p>
<p>
Here is a diagram showing how <code class="computeroutput"><span class="identifier">repeated_reject_incomplete</span></code>
works by example:
</p>
<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'+'</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_int</span> <span class="special">=</span> <span class="identifier">last_of</span><span class="special">&lt;</span><span class="identifier">plus_token</span><span class="special">,</span> <span class="identifier">int_token</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">sum_op</span> <span class="special">=</span> <span class="identifier">mpl</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">&lt;</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">plus</span><span class="special">&lt;</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_1</span><span class="special">,</span> <span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_2</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">;</span>
</pre>
<p>
<span class="inlinemediaobject"><img src="../images/metaparse/repeated_reject_incomplete_diag1.png" width="70%"></span>
</p>
<h2>
<a name="metaparse.reference.alphabetical.repeated_reject_incomplete.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated_reject_incomplete.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated_reject_incomplete.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">repeated_reject_incomplete</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.repeated_reject_incomplete.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated_reject_incomplete.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated_reject_incomplete.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser, <code class="computeroutput"><span class="identifier">s</span></code> compile-time string and <code class="computeroutput"><span class="identifier">pos</span></code> source position
</p>
<pre class="programlisting"><span class="identifier">repeated_reject_incomplete</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<p>
is equivalent to
</p>
<pre class="programlisting"><span class="identifier">first_of</span><span class="special">&lt;</span><span class="identifier">repeated</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">&gt;,</span> <span class="identifier">fail_at_first_char_expected</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">&gt;</span> <span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.repeated_reject_incomplete.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated_reject_incomplete.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated_reject_incomplete.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">repeated_reject_incomplete</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">last_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">token</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">equal</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">vector_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'+'</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_int</span> <span class="special">=</span> <span class="identifier">last_of</span><span class="special">&lt;</span><span class="identifier">plus_token</span><span class="special">,</span> <span class="identifier">int_token</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">ints</span> <span class="special">=</span> <span class="identifier">repeated_reject_incomplete</span><span class="special">&lt;</span><span class="identifier">plus_int</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">equal</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">vector_c</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">,</span> <span class="number">3</span><span class="special">,</span> <span class="number">21</span><span class="special">&gt;,</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"+ 13 + 3 + 21"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"ints should parse the numbers"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">ints</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"+ 13 + 3 +"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"when the last number is missing, it should be an error"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.repeated_one_of1"></a><a name="repeated_one_of1"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated_one_of1" title="repeated_one_of1">repeated_one_of1</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.repeated_one_of1.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated_one_of1.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated_one_of1.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span><span class="special">...</span> <span class="identifier">Ps</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">repeated_one_of1</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.repeated_one_of1.arguments"></a><p class="title"><b>Table 24.75. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Ps</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>s
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.repeated_one_of1.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated_one_of1.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated_one_of1.description">Description</a>
</h2>
<p>
It applies the <code class="computeroutput"><span class="identifier">Ps</span><span class="special">...</span></code>
parsers repeatedly as long as any of them accepts the input. In each iteration
the parsers are tried in order and the first one accepting the input is
used, therefore in case of ambiguous grammars the result of parsing depends
on the order of the <code class="computeroutput"><span class="identifier">Ps</span><span class="special">...</span></code> parsers. The result of parsing with
this <a class="link" href="reference.html#parser_combinator">parser combinator</a> is a sequence
of the individual parsing results.
</p>
<p>
When none of the <code class="computeroutput"><span class="identifier">Ps</span><span class="special">...</span></code>
parsers accept the input in the first iteration, <code class="computeroutput"><span class="identifier">repeated_one_of1</span></code>
rejects the input.
</p>
<p>
On compilers, which are not C++11-compliant, the maximum number of accepted
parsers is defined by the <code class="computeroutput"><span class="identifier">BOOST_METAPARSE_LIMIT_ONE_OF_SIZE</span></code>
macro. Its default value is 20.
</p>
<h2>
<a name="metaparse.reference.alphabetical.repeated_one_of1.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated_one_of1.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated_one_of1.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">repeated_one_of1</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.repeated_one_of1.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated_one_of1.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated_one_of1.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p1</span></code>, ..., <code class="computeroutput"><span class="identifier">pn</span></code> parsers
</p>
<pre class="programlisting"><span class="identifier">repeated_one_of1</span><span class="special">&lt;</span><span class="identifier">p1</span><span class="special">,</span> <span class="comment">/* ... */</span><span class="special">,</span> <span class="identifier">pn</span><span class="special">&gt;</span>
</pre>
<p>
is equivalent to
</p>
<pre class="programlisting"><span class="identifier">repeated1</span><span class="special">&lt;</span><span class="identifier">one_of</span><span class="special">&lt;</span><span class="identifier">p1</span><span class="special">,</span> <span class="comment">/* ... */</span><span class="special">,</span> <span class="identifier">pn</span><span class="special">&gt;&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.repeated_one_of1.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated_one_of1.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated_one_of1.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">repeated_one_of1</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">equal</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">vector</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="keyword">char</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">as_and_bs</span> <span class="special">=</span> <span class="identifier">repeated_one_of1</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'a'</span><span class="special">&gt;,</span> <span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'b'</span><span class="special">&gt;&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">equal</span><span class="special">&lt;</span>
<span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">as_and_bs</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"abaab"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'a'</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'b'</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'a'</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'a'</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'b'</span><span class="special">&gt;</span>
<span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"the result of parsing should be the list of results"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">as_and_bs</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"x"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"repeated_one_of1 should reject the input when it"</span>
<span class="string">" can't parse anything with digit_val"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.repeated_one_of"></a><a name="repeated_one_of"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated_one_of" title="repeated_one_of">repeated_one_of</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.repeated_one_of.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated_one_of.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated_one_of.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span><span class="special">...</span> <span class="identifier">Ps</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">repeated_one_of1</span><span class="special">;</span>
</pre>
<div class="table">
<a name="metaparse.reference.alphabetical.repeated_one_of.arguments"></a><p class="title"><b>Table 24.76. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Ps</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>s
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.repeated_one_of.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated_one_of.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated_one_of.description">Description</a>
</h2>
<p>
It applies the <code class="computeroutput"><span class="identifier">Ps</span><span class="special">...</span></code>
parsers repeatedly as long as any of them accepts the input. In each iteration
the parsers are tried in order and the first one accepting the input is
used, therefore in case of ambiguous grammars the result of parsing depends
on the order of the <code class="computeroutput"><span class="identifier">Ps</span><span class="special">...</span></code> parsers. The result of parsing with
this <a class="link" href="reference.html#parser_combinator">parser combinator</a> is a sequence
of the individual parsing results.
</p>
<p>
When none of the <code class="computeroutput"><span class="identifier">Ps</span><span class="special">...</span></code>
parsers accept the input in the first iteration, <code class="computeroutput"><span class="identifier">repeated_one_of</span></code>
accepts the input and the result of parsing is an empty sequence.
</p>
<p>
On compilers, which are not C++11-compliant, the maximum number of accepted
parsers is defined by the <code class="computeroutput"><span class="identifier">BOOST_METAPARSE_LIMIT_ONE_OF_SIZE</span></code>
macro. Its default value is 20.
</p>
<h2>
<a name="metaparse.reference.alphabetical.repeated_one_of.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated_one_of.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated_one_of.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">repeated_one_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.repeated_one_of.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated_one_of.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated_one_of.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p1</span></code>, ..., <code class="computeroutput"><span class="identifier">pn</span></code> parsers
</p>
<pre class="programlisting"><span class="identifier">repeated_one_of</span><span class="special">&lt;</span><span class="identifier">p1</span><span class="special">,</span> <span class="comment">/* ... */</span><span class="special">,</span> <span class="identifier">pn</span><span class="special">&gt;</span>
</pre>
<p>
is equivalent to
</p>
<pre class="programlisting"><span class="identifier">repeated</span><span class="special">&lt;</span><span class="identifier">one_of</span><span class="special">&lt;</span><span class="identifier">p1</span><span class="special">,</span> <span class="comment">/* ... */</span><span class="special">,</span> <span class="identifier">pn</span><span class="special">&gt;&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.repeated_one_of.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated_one_of.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated_one_of.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">repeated_one_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">equal</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">vector</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="keyword">char</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">as_and_bs</span> <span class="special">=</span> <span class="identifier">repeated_one_of</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'a'</span><span class="special">&gt;,</span> <span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'b'</span><span class="special">&gt;&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">equal</span><span class="special">&lt;</span>
<span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">as_and_bs</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"abaab"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'a'</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'b'</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'a'</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'a'</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">char_</span><span class="special">&lt;</span><span class="char">'b'</span><span class="special">&gt;</span>
<span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"the result of parsing should be the list of results"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">equal</span><span class="special">&lt;</span>
<span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">as_and_bs</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"x"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"repeated_one_of should accept the input when it"</span>
<span class="string">" can't parse anything with digit_val"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.repeated"></a><a name="repeated"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated" title="repeated">repeated</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.repeated.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">repeated</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.repeated.arguments"></a><p class="title"><b>Table 24.77. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.repeated.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated.description">Description</a>
</h2>
<p>
It applies <code class="computeroutput"><span class="identifier">P</span></code> on the input
string repeatedly as long as <code class="computeroutput"><span class="identifier">P</span></code>
accepts the input. The result of parsing is a sequence of the results of
the individual applications of <code class="computeroutput"><span class="identifier">P</span></code>.
</p>
<p>
When <code class="computeroutput"><span class="identifier">P</span></code> rejects the input
for the first time, <code class="computeroutput"><span class="identifier">repeated</span></code>
still accepts the input and the result of parsing is an empty sequence.
</p>
<p>
Here is a diagram showing how <code class="computeroutput"><span class="identifier">repeated</span></code>
works by example:
</p>
<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
</pre>
<p>
<span class="inlinemediaobject"><img src="../images/metaparse/repeated_diag1.png" width="70%"></span>
</p>
<p>
Further details can be found in the <a class="link" href="user_manual.html#repetition">Repetition</a>
section of the <a class="link" href="user_manual.html#manual">User Manual</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.repeated.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">repeated</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.repeated.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser the following
are equivalent:
</p>
<pre class="programlisting"><span class="identifier">repeated</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">&gt;</span>
<span class="identifier">foldl</span><span class="special">&lt;</span>
<span class="identifier">p</span><span class="special">,</span>
<span class="comment">/* unspecified empty sequence */</span><span class="special">,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">push_back</span><span class="special">&lt;</span><span class="identifier">_2</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">&gt;</span>
<span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.repeated.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.repeated.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.repeated.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">repeated</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">digit_val</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">equal</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">vector</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="keyword">int</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">digits</span> <span class="special">=</span> <span class="identifier">repeated</span><span class="special">&lt;</span><span class="identifier">digit_val</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">equal</span><span class="special">&lt;</span>
<span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">digits</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"1234"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">1</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">2</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">3</span><span class="special">&gt;,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="number">4</span><span class="special">&gt;</span>
<span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"the result of parsing should be the list of digit values"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">equal</span><span class="special">&lt;</span>
<span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">digits</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"x"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"repeated should accept the input when it can't parse anything with digit_val"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.return"></a><a name="return_"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.return" title="return_">return_</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.return.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.return.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.return.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">C</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">return_</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser">parser</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.return.arguments"></a><p class="title"><b>Table 24.78. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">C</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a>
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.return.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.return.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.return.description">Description</a>
</h2>
<p>
<code class="computeroutput"><span class="identifier">return_</span></code> accepts every input.
The result of parsing is <code class="computeroutput"><span class="identifier">C</span></code>,
the remaining string is the input string.
</p>
<h2>
<a name="metaparse.reference.alphabetical.return.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.return.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.return.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">return_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.return.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.return.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.return.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">c</span></code> class, <code class="computeroutput"><span class="identifier">s</span></code> compile-time string and <code class="computeroutput"><span class="identifier">pos</span></code> source position the following are
equivalent
</p>
<pre class="programlisting"><span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">return_</span><span class="special">&lt;</span><span class="identifier">c</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="identifier">c</span>
<span class="identifier">get_remaining</span><span class="special">&lt;</span><span class="identifier">return_</span><span class="special">&lt;</span><span class="identifier">c</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="identifier">s</span>
<span class="identifier">get_position</span><span class="special">&lt;</span><span class="identifier">return_</span><span class="special">&lt;</span><span class="identifier">c</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="identifier">pos</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.return.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.return.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.return.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">return_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">one_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">default_value</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">optional_number</span> <span class="special">=</span> <span class="identifier">one_of</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">,</span> <span class="identifier">return_</span><span class="special">&lt;</span><span class="identifier">default_value</span><span class="special">&gt;&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">optional_number</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"11"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">11</span><span class="special">,</span>
<span class="string">"when a number is provided, it is the result of parsing"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">optional_number</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">""</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">13</span><span class="special">,</span>
<span class="string">"when no number is provided, the default value is the result of parsing"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.sequence"></a><a name="sequence"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.sequence" title="sequence">sequence</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.sequence.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.sequence.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.sequence.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span><span class="special">...</span> <span class="identifier">Ps</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">sequence</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.sequence.arguments"></a><p class="title"><b>Table 24.79. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Ps</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>s
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.sequence.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.sequence.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.sequence.description">Description</a>
</h2>
<p>
<code class="computeroutput"><span class="identifier">sequence</span></code> applies the <code class="computeroutput"><span class="identifier">Ps</span><span class="special">...</span></code>
parsers in sequence on the input. It accepts an input when all of these
parsers accept it. The result of parsing is a sequence of the results of
the parsers.
</p>
<p>
On compilers, which are not C++11-compliant, the maximum number of parsers
<code class="computeroutput"><span class="identifier">sequence</span></code> accepts can be
specified with the <code class="computeroutput"><span class="identifier">BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE</span></code>
macro. Its default value is <code class="computeroutput"><span class="number">5</span></code>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.sequence.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.sequence.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.sequence.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">sequence</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.sequence.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.sequence.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.sequence.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">n</span> <span class="special">&gt;</span>
<span class="number">0</span></code>, <code class="computeroutput"><span class="identifier">p0</span></code>,
..., <code class="computeroutput"><span class="identifier">pn</span></code> parsers the result
of <code class="computeroutput"><span class="identifier">sequence</span><span class="special">&lt;</span><span class="identifier">p0</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">p1</span><span class="special">&gt;</span></code> is a compile-time sequence of the results
of the parsers, applied after each other in order on the input string when
none of them returns an error. The remaining string is the remaining string
the last parser returns.
</p>
<p>
When one of the parsers returns an error, the combinator returns that error.
</p>
<h2>
<a name="metaparse.reference.alphabetical.sequence.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.sequence.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.sequence.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">sequence</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">token</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">at</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">plus_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'+'</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">a_plus_b</span> <span class="special">=</span> <span class="identifier">sequence</span><span class="special">&lt;</span><span class="identifier">int_token</span><span class="special">,</span> <span class="identifier">plus_token</span><span class="special">,</span> <span class="identifier">int_token</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">at_c</span><span class="special">&lt;</span>
<span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">a_plus_b</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"1 + 2"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="number">0</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">1</span><span class="special">,</span>
<span class="string">"the first element of the sequence should be the first number"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">at_c</span><span class="special">&lt;</span>
<span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">a_plus_b</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"1 + 2"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="number">1</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="char">'+'</span><span class="special">,</span>
<span class="string">"the second element of the sequence should be the plus"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">at_c</span><span class="special">&lt;</span>
<span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">a_plus_b</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"1 + 2"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="number">2</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">2</span><span class="special">,</span>
<span class="string">"the third element of the sequence should be the second number"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">a_plus_b</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"1 +"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"when not all of the parsers accept the input, sequence should fail"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.sequence_apply"></a><a name="sequence_apply"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.sequence_apply" title="sequence_apply">sequence_apply</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.sequence_apply.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.sequence_apply.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.sequence_apply.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span><span class="special">,</span> <span class="special">...,</span> <span class="keyword">class</span><span class="special">&gt;</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">P1</span><span class="special">,</span> <span class="special">...,</span> <span class="keyword">class</span> <span class="identifier">Pn</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">sequence_applyn</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.sequence_apply.arguments"></a><p class="title"><b>Table 24.80. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
T
</p>
</th>
<th>
<p>
Template class taking <code class="computeroutput"><span class="identifier">n</span></code>
arguments
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P1</span></code>..<code class="computeroutput"><span class="identifier">Pn</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>s
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.sequence_apply.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.sequence_apply.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.sequence_apply.description">Description</a>
</h2>
<p>
It applies the <code class="computeroutput"><span class="identifier">P1</span></code> ...
<code class="computeroutput"><span class="identifier">Pn</span></code> <a class="link" href="reference.html#parser">parser</a>s
on the input in order. When all of them succeed, the result of parsing
with <code class="computeroutput"><span class="identifier">sequence_applyn</span></code> is
the <code class="computeroutput"><span class="identifier">T</span></code> template class instantiated
with the results of the <code class="computeroutput"><span class="identifier">P1</span></code>
... <code class="computeroutput"><span class="identifier">Pn</span></code> <a class="link" href="reference.html#parser">parser</a>s.
When any of the <code class="computeroutput"><span class="identifier">P1</span></code> ...
<code class="computeroutput"><span class="identifier">Pn</span></code> <a class="link" href="reference.html#parser">parser</a>s
reject the input, the error is propagated.
</p>
<p>
<code class="computeroutput"><span class="identifier">n</span></code> has to be in the <code class="computeroutput"><span class="special">[</span><span class="number">1.</span><span class="special">.</span><span class="identifier">BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE</span><span class="special">)</span></code>
range.
</p>
<h2>
<a name="metaparse.reference.alphabetical.sequence_apply.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.sequence_apply.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.sequence_apply.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">sequence_apply</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.sequence_apply.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.sequence_apply.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.sequence_apply.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">n</span> <span class="special">&gt;</span>
<span class="number">0</span></code>, <code class="computeroutput"><span class="identifier">p1</span></code>
... <code class="computeroutput"><span class="identifier">pn</span></code> <a class="link" href="reference.html#parser">parser</a>s,
<code class="computeroutput"><span class="identifier">t</span></code> template class with
<code class="computeroutput"><span class="identifier">n</span></code> <code class="computeroutput"><span class="keyword">class</span></code>
arguments, <code class="computeroutput"><span class="identifier">s</span></code> compile-time
string and <code class="computeroutput"><span class="identifier">pos</span></code> source position
the following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">sequence_apply</span><span class="special">&lt;</span><span class="identifier">t</span><span class="special">,</span> <span class="identifier">p1</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">pn</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;::</span><span class="identifier">type</span>
</pre>
<p>
when <a class="link" href="reference.html#sequence"><code class="computeroutput"><span class="identifier">sequence</span></code></a><code class="computeroutput"><span class="special">&lt;</span><span class="identifier">p1</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">pn</span><span class="special">&gt;</span></code>
accepts the input:
</p>
<pre class="programlisting"><span class="identifier">return_</span><span class="special">&lt;</span>
<span class="identifier">t</span><span class="special">&lt;</span>
<span class="identifier">mpl</span><span class="special">::</span><span class="identifier">at_c</span><span class="special">&lt;</span><span class="number">0</span><span class="special">,</span> <span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">sequence</span><span class="special">&lt;</span><span class="identifier">p1</span><span class="special">,...,</span><span class="identifier">pn</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="special">...</span>
<span class="identifier">mpl</span><span class="special">::</span><span class="identifier">at_c</span><span class="special">&lt;</span><span class="identifier">n</span><span class="special">,</span> <span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">sequence</span><span class="special">&lt;</span><span class="identifier">p1</span><span class="special">,...,</span><span class="identifier">pn</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;::</span><span class="identifier">type</span>
</pre>
<p>
when <a class="link" href="reference.html#sequence"><code class="computeroutput"><span class="identifier">sequence</span></code></a><code class="computeroutput"><span class="special">&lt;</span><span class="identifier">p1</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">pn</span><span class="special">&gt;</span></code>
rejects the input:
</p>
<pre class="programlisting"><span class="identifier">sequence</span><span class="special">&lt;</span><span class="identifier">p1</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">pn</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;::</span><span class="identifier">type</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.sequence_apply.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.sequence_apply.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.sequence_apply.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">sequence_apply</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">middle_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">lit_c</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">/</span><span class="identifier">is_same</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">int</span> <span class="identifier">Real</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">Imaginary</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">complex_c</span> <span class="special">{</span> <span class="keyword">typedef</span> <span class="identifier">complex_c</span> <span class="identifier">type</span><span class="special">;</span> <span class="special">};</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Real</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Imaginary</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">complex</span> <span class="special">:</span> <span class="identifier">complex_c</span><span class="special">&lt;</span><span class="identifier">Real</span><span class="special">::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span> <span class="identifier">Imaginary</span><span class="special">::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">&gt;</span> <span class="special">{};</span>
<span class="keyword">typedef</span>
<span class="identifier">sequence_apply2</span><span class="special">&lt;</span><span class="identifier">complex</span><span class="special">,</span> <span class="identifier">int_</span><span class="special">,</span> <span class="identifier">middle_of</span><span class="special">&lt;</span><span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'+'</span><span class="special">&gt;,</span> <span class="identifier">int_</span><span class="special">,</span> <span class="identifier">lit_c</span><span class="special">&lt;</span><span class="char">'i'</span><span class="special">&gt;&gt;&gt;</span>
<span class="identifier">complex_parser</span><span class="special">;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
<span class="identifier">complex_c</span><span class="special">&lt;</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">&gt;,</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">complex_parser</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"1+2i"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">type</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"the result of parsing should be the list of digit values"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.source_position"></a><a name="source_position"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.source_position" title="source_position">source_position</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.source_position.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.source_position.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.source_position.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Line</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Col</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">PrevChar</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">source_position</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.source_position.arguments"></a><p class="title"><b>Table 24.81. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Line</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#boxed_value">boxed</a> integer value
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Col</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#boxed_value">boxed</a> integer value
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">PrevChar</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#boxed_value">boxed</a> character value
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.source_position.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.source_position.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.source_position.description">Description</a>
</h2>
<p>
Compile-time data-structure describing a position of the input text.
</p>
<p>
The values of this data-structure store the last character that was parsed
before reaching the position of the input described by the <code class="computeroutput"><span class="identifier">source_position</span></code> value.
</p>
<p>
Its tag is <a class="link" href="reference.html#source_position_tag"><code class="computeroutput"><span class="identifier">source_position_tag</span></code></a>.
</p>
<p>
The beginning of the input text is represented by <a class="link" href="reference.html#start"><code class="computeroutput"><span class="identifier">start</span></code></a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.source_position.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.source_position.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.source_position.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">source_position</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.source_position.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.source_position.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.source_position.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">l</span></code>, <code class="computeroutput"><span class="identifier">c</span></code> compile-time boxed integral values
and <code class="computeroutput"><span class="identifier">p</span></code> compile-time boxed
character value, the following are equivalent
</p>
<pre class="programlisting"><span class="identifier">get_col</span><span class="special">&lt;</span><span class="identifier">source_position</span><span class="special">&lt;</span><span class="identifier">l</span><span class="special">,</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">p</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="identifier">c</span><span class="special">::</span><span class="identifier">type</span>
<span class="identifier">get_line</span><span class="special">&lt;</span><span class="identifier">source_position</span><span class="special">&lt;</span><span class="identifier">l</span><span class="special">,</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">p</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="identifier">l</span><span class="special">::</span><span class="identifier">type</span>
<span class="identifier">get_prev_char</span><span class="special">&lt;</span><span class="identifier">source_position</span><span class="special">&lt;</span><span class="identifier">l</span><span class="special">,</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">p</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="identifier">p</span><span class="special">::</span><span class="identifier">type</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.source_position.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.source_position.constant_values_of_this_type"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.source_position.constant_values_of_this_type">Constant
values of this type</a>
</h2>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
<a class="link" href="reference.html#start"><code class="computeroutput"><span class="identifier">start</span></code></a>
</li></ul></div>
<h2>
<a name="metaparse.reference.alphabetical.source_position.h5"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.source_position.operations"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.source_position.operations">Operations</a>
</h2>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">equal_to</span></code>
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">greater</span></code>
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">greater_equal</span></code>
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">less</span></code>
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">less_equal</span></code>
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">not_equal_to</span></code>
</li>
<li class="listitem">
<a class="link" href="reference.html#get_col"><code class="computeroutput"><span class="identifier">get_col</span></code></a>
</li>
<li class="listitem">
<a class="link" href="reference.html#get_line"><code class="computeroutput"><span class="identifier">get_line</span></code></a>
</li>
<li class="listitem">
<a class="link" href="reference.html#get_prev_char"><code class="computeroutput"><span class="identifier">get_prev_char</span></code></a>
</li>
<li class="listitem">
<a class="link" href="reference.html#next_char"><code class="computeroutput"><span class="identifier">next_char</span></code></a>
</li>
<li class="listitem">
<a class="link" href="reference.html#next_line"><code class="computeroutput"><span class="identifier">next_line</span></code></a>
</li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.source_position_tag"></a><a name="source_position_tag"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.source_position_tag" title="source_position_tag">source_position_tag</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.source_position_tag.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.source_position_tag.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.source_position_tag.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">source_position_tag</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#tag">tag</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.source_position_tag.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.source_position_tag.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.source_position_tag.description">Description</a>
</h2>
<p>
This is the tag of the <a class="link" href="reference.html#source_position"><code class="computeroutput"><span class="identifier">source_position</span></code></a>
values.
</p>
<h2>
<a name="metaparse.reference.alphabetical.source_position_tag.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.source_position_tag.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.source_position_tag.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">source_position_tag</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.space"></a><a name="space"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.space" title="space">space</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.space.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.space.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.space.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">space</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser">parser</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.space.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.space.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.space.description">Description</a>
</h2>
<p>
<code class="computeroutput"><span class="identifier">space</span></code> accepts one white
space character. The result of parsing is the parsed character.
</p>
<h2>
<a name="metaparse.reference.alphabetical.space.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.space.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.space.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">space</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.space.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.space.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.space.expression_semantics">Expression
semantics</a>
</h2>
<p>
The following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">space</span>
<span class="identifier">accept_when</span><span class="special">&lt;</span><span class="identifier">one_char</span><span class="special">,</span> <span class="identifier">util</span><span class="special">::</span><span class="identifier">is_whitespace</span><span class="special">&lt;&gt;,</span> <span class="identifier">errors</span><span class="special">::</span><span class="identifier">whitespace_expected</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.space.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.space.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.space.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">space</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_remaining</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
<span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">" foo"</span><span class="special">),</span>
<span class="identifier">get_remaining</span><span class="special">&lt;</span><span class="identifier">space</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">" foo"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should consume the first space of the input"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">space</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"x"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should return an error when the input does not begin with a whitespace"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.spaces"></a><a name="spaces"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.spaces" title="spaces">spaces</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.spaces.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.spaces.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.spaces.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">spaces</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser">parser</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.spaces.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.spaces.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.spaces.description">Description</a>
</h2>
<p>
<code class="computeroutput"><span class="identifier">spaces</span></code> accepts any number
of whitespace characters. It requires at least one to be present.
</p>
<h2>
<a name="metaparse.reference.alphabetical.spaces.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.spaces.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.spaces.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">spaces</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.spaces.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.spaces.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.spaces.expression_semantics">Expression
semantics</a>
</h2>
<pre class="programlisting"><span class="identifier">spaces</span>
</pre>
<p>
is equivalent to
</p>
<pre class="programlisting"><span class="identifier">repeated1</span><span class="special">&lt;</span><span class="identifier">space</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.spaces.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.spaces.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.spaces.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">spaces</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_remaining</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
<span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"foo"</span><span class="special">),</span>
<span class="identifier">get_remaining</span><span class="special">&lt;</span><span class="identifier">spaces</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">" foo"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should consume all whitespaces at the beginning of the input"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">spaces</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"x"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it should return an error when the input does not begin with a whitespace"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.start"></a><a name="start"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.start" title="start">start</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.start.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.start.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.start.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">start</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a> of type <a class="link" href="reference.html#source_position">source position</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.start.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.start.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.start.description">Description</a>
</h2>
<p>
It represents the beginning of an input text.
</p>
<h2>
<a name="metaparse.reference.alphabetical.start.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.start.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.start.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.string"></a><a name="string"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.string" title="string">string</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.string.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.string.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.string.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">char</span> <span class="identifier">C1</span><span class="special">,</span> <span class="special">...,</span> <span class="keyword">char</span> <span class="identifier">Cn</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">string</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.string.arguments"></a><p class="title"><b>Table 24.82. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">C1</span></code>..<code class="computeroutput"><span class="identifier">Cn</span></code>
</p>
</td>
<td>
<p>
character values
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.string.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.string.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.string.description">Description</a>
</h2>
<p>
Compile-time data-structure describing a string object. These string objects
are compatible with <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">string</span></code>,
but they accept only individual characters as arguments. When <code class="computeroutput"><span class="keyword">constexpr</span></code> is available, they can be constructed
using the <a class="link" href="reference.html#BOOST_METAPARSE_STRING"><code class="computeroutput"><span class="identifier">BOOST_METAPARSE_STRING</span></code></a>
macro.
</p>
<p>
The tag of the strings is <a class="link" href="reference.html#string_tag"><code class="computeroutput"><span class="identifier">string_tag</span></code></a>.
</p>
<p>
<span class="bold"><strong>C++98</strong></span>: The maximum length of these strings
is controlled by the <code class="computeroutput"><span class="identifier">BOOST_METAPARSE_LIMIT_STRING_SIZE</span></code>
macro.
</p>
<p>
<span class="bold"><strong>C++11</strong></span>: The strings use variadic templates.
</p>
<h2>
<a name="metaparse.reference.alphabetical.string.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.string.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.string.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.string.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.string.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.string.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">hello1</span> <span class="special">=</span> <span class="identifier">string</span><span class="special">&lt;</span><span class="char">'H'</span><span class="special">,</span><span class="char">'e'</span><span class="special">,</span><span class="char">'l'</span><span class="special">,</span><span class="char">'l'</span><span class="special">,</span><span class="char">'o'</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">hello2</span> <span class="special">=</span> <span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"Hello"</span><span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
<span class="identifier">string</span><span class="special">&lt;</span><span class="char">'H'</span><span class="special">,</span> <span class="char">'e'</span><span class="special">,</span> <span class="char">'l'</span><span class="special">,</span> <span class="char">'l'</span><span class="special">,</span> <span class="char">'o'</span><span class="special">&gt;,</span>
<span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"Hello"</span><span class="special">)</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"The type generated by the macro should be identical to the hand-crafted one."</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.string_tag"></a><a name="string_tag"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.string_tag" title="string_tag">string_tag</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.string_tag.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.string_tag.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.string_tag.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">string_tag</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#tag">tag</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.string_tag.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.string_tag.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.string_tag.description">Description</a>
</h2>
<p>
This is the tag of the <a class="link" href="reference.html#string"><code class="computeroutput"><span class="identifier">string</span></code></a>
values.
</p>
<h2>
<a name="metaparse.reference.alphabetical.string_tag.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.string_tag.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.string_tag.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string_tag</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.tag"></a><a name="tag"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.tag" title="Tag">Tag</a>
</h4></div></div></div>
<p>
A <span class="emphasis"><em>tag</em></span> is a <a class="link" href="reference.html#metaprogramming_value">template
metaprogramming value</a> used to identify groups of values.
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.token"></a><a name="token"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.token" title="token">token</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.token.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.token.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.token.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">token</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.token.arguments"></a><p class="title"><b>Table 24.83. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.token.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.token.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.token.description">Description</a>
</h2>
<p>
<code class="computeroutput"><span class="identifier">token</span></code> parses the input
using <code class="computeroutput"><span class="identifier">P</span></code> when it succeeds,
<code class="computeroutput"><span class="identifier">token</span></code> consumes all whitespaces
afterwards. The result of parsing is the result of <code class="computeroutput"><span class="identifier">P</span></code>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.token.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.token.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.token.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">token</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.token.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.token.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.token.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser the following
are equivalent:
</p>
<pre class="programlisting"><span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">&gt;</span>
<span class="identifier">first_of</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">spaces</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.token.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.token.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.token.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">token</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">int_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_remaining</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">int_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">int_</span><span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">int_token</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"13 "</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"the result of int_token is the number"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
<span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">""</span><span class="special">),</span>
<span class="identifier">get_remaining</span><span class="special">&lt;</span><span class="identifier">int_token</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"13 "</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"token consumes whitespaces after the number"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">int_token</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"13"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"whitespaces after the number are optional"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">int_token</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"foo"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"when there is no number, token fails"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.transform_error_message"></a><a name="transform_error_message"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.transform_error_message" title="transform_error_message">transform_error_message</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.transform_error_message.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.transform_error_message.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.transform_error_message.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">F</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">transform_error_message</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.transform_error_message.arguments"></a><p class="title"><b>Table 24.84. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">F</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metafunction_class">template metafunction class</a>
taking one argument
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.transform_error_message.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.transform_error_message.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.transform_error_message.description">Description</a>
</h2>
<p>
It parses the input with <code class="computeroutput"><span class="identifier">P</span></code>.
When this succeeds, the result of parsing with <code class="computeroutput"><span class="identifier">transform_error_message</span></code>
will be the result of parsing with <code class="computeroutput"><span class="identifier">P</span></code>.
When it fails, the error <code class="computeroutput"><span class="identifier">P</span></code>
returns is forwarded to the caller of <code class="computeroutput"><span class="identifier">transform_error_message</span></code>,
but the message of it is transformed with <code class="computeroutput"><span class="identifier">F</span></code>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.transform_error_message.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.transform_error_message.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.transform_error_message.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">transform_error_message</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.transform_error_message.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.transform_error_message.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.transform_error_message.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser and <code class="computeroutput"><span class="identifier">f</span></code> metafunction class accepting one argument
</p>
<pre class="programlisting"><span class="identifier">transform_error_message</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">f</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<p>
is equivalent to <code class="computeroutput"><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span></code> when <code class="computeroutput"><span class="identifier">p</span></code>
accepts the input. It is equivalent to <code class="computeroutput"><span class="identifier">reject</span><span class="special">&lt;</span><span class="identifier">f</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">get_message</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">&gt;,</span> <span class="identifier">get_position</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;&gt;</span></code> otherwise.
</p>
<h2>
<a name="metaparse.reference.alphabetical.transform_error_message.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.transform_error_message.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.transform_error_message.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">transform_error_message</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">repeated1</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">letter</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">keyword</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">last_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">token</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_message</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">define_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">reject</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="identifier">BOOST_METAPARSE_DEFINE_ERROR</span><span class="special">(</span><span class="identifier">name_expected</span><span class="special">,</span> <span class="string">"Name expected"</span><span class="special">);</span>
<span class="keyword">struct</span> <span class="identifier">return_name_expected</span>
<span class="special">{</span>
<span class="keyword">typedef</span> <span class="identifier">return_name_expected</span> <span class="identifier">type</span><span class="special">;</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">apply</span> <span class="special">:</span> <span class="identifier">name_expected</span> <span class="special">{};</span>
<span class="special">};</span>
<span class="keyword">using</span> <span class="identifier">keyword_name</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">keyword</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"name"</span><span class="special">)&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">name_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">repeated1</span><span class="special">&lt;</span><span class="identifier">letter</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">name_parser</span> <span class="special">=</span>
<span class="identifier">last_of</span><span class="special">&lt;</span>
<span class="identifier">keyword_name</span><span class="special">,</span>
<span class="identifier">transform_error_message</span><span class="special">&lt;</span><span class="identifier">name_token</span><span class="special">,</span> <span class="identifier">return_name_expected</span><span class="special">&gt;</span>
<span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">name_parser</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"name Bela"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"name_parser should accept \"name &lt;a name&gt;\""</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">name_parser</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"name ?"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"name_parser should reject input when name is a question mark"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
<span class="identifier">get_message</span><span class="special">&lt;</span>
<span class="identifier">name_parser</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"name ?"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="identifier">name_expected</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"the error message should be the one specified by change_error_message"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.transform_error"></a><a name="transform_error"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.transform_error" title="transform_error">transform_error</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.transform_error.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.transform_error.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.transform_error.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">F</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">transform_error</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.transform_error.arguments"></a><p class="title"><b>Table 24.85. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">F</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metafunction_class">template metafunction class</a>
taking one argument
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.transform_error.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.transform_error.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.transform_error.description">Description</a>
</h2>
<p>
It parses the input with <code class="computeroutput"><span class="identifier">P</span></code>.
When this succeeds, the result of parsing with <code class="computeroutput"><span class="identifier">transform_error</span></code>
will be the result of parsing with <code class="computeroutput"><span class="identifier">P</span></code>.
When it fails, <code class="computeroutput"><span class="identifier">F</span></code> is evaluated
with the error <code class="computeroutput"><span class="identifier">P</span></code> returned
as argument. Parsing with <code class="computeroutput"><span class="identifier">transform_error</span></code>
will fail and the error will be what <code class="computeroutput"><span class="identifier">F</span></code>
returns. Therefore, <code class="computeroutput"><span class="identifier">F</span></code> is
expected to accept and return a <a class="link" href="reference.html#reject"><code class="computeroutput"><span class="identifier">reject</span></code></a>
value.
</p>
<h2>
<a name="metaparse.reference.alphabetical.transform_error.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.transform_error.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.transform_error.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">transform_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.transform_error.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.transform_error.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.transform_error.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser and <code class="computeroutput"><span class="identifier">f</span></code> metafunction class accepting one argument
</p>
<pre class="programlisting"><span class="identifier">transform_error</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">f</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span>
</pre>
<p>
is equivalent to <code class="computeroutput"><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span></code> when <code class="computeroutput"><span class="identifier">p</span></code>
accepts the input. It is equivalent to <code class="computeroutput"><span class="identifier">f</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&gt;</span></code> otherwise.
</p>
<h2>
<a name="metaparse.reference.alphabetical.transform_error.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.transform_error.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.transform_error.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">transform_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">repeated1</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">letter</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">keyword</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">last_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">token</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_message</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_position</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">define_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">reject</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="identifier">lambda</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="identifier">BOOST_METAPARSE_DEFINE_ERROR</span><span class="special">(</span><span class="identifier">name_expected</span><span class="special">,</span> <span class="string">"Name expected"</span><span class="special">);</span>
<span class="keyword">using</span> <span class="identifier">keyword_name</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">keyword</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"name"</span><span class="special">)&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">name_token</span> <span class="special">=</span> <span class="identifier">token</span><span class="special">&lt;</span><span class="identifier">repeated1</span><span class="special">&lt;</span><span class="identifier">letter</span><span class="special">&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">name_parser</span> <span class="special">=</span>
<span class="identifier">last_of</span><span class="special">&lt;</span>
<span class="identifier">keyword_name</span><span class="special">,</span>
<span class="identifier">transform_error</span><span class="special">&lt;</span>
<span class="identifier">name_token</span><span class="special">,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">&lt;</span>
<span class="identifier">reject</span><span class="special">&lt;</span><span class="identifier">name_expected</span><span class="special">,</span> <span class="identifier">get_position</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_1</span><span class="special">&gt;</span> <span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;</span>
<span class="special">&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">name_parser</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"name Bela"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"name_parser should accept \"name &lt;a name&gt;\""</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">name_parser</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"name ?"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"name_parser should reject input when name is a question mark"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
<span class="identifier">get_message</span><span class="special">&lt;</span>
<span class="identifier">name_parser</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"name ?"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span>
<span class="identifier">name_expected</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"the error message should be the one specified by change_error_message"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.transform"></a><a name="transform"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.transform" title="transform">transform</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.transform.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.transform.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.transform.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">P</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">transform</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parser_combinator">parser combinator</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.transform.arguments"></a><p class="title"><b>Table 24.86. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">P</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#parser">parser</a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">T</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metafunction_class">template metafunction class</a>
taking one argument
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.transform.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.transform.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.transform.description">Description</a>
</h2>
<p>
<code class="computeroutput"><span class="identifier">transform</span></code> parses the input
using <code class="computeroutput"><span class="identifier">P</span></code> and transforms
the result <code class="computeroutput"><span class="identifier">P</span></code> returns with
<code class="computeroutput"><span class="identifier">T</span></code>. The result of parsing
is what <code class="computeroutput"><span class="identifier">T</span></code> returns. When
<code class="computeroutput"><span class="identifier">P</span></code> fails, the failure is
returned unchanged.
</p>
<h2>
<a name="metaparse.reference.alphabetical.transform.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.transform.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.transform.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">transform</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.transform.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.transform.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.transform.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">p</span></code> parser, <code class="computeroutput"><span class="identifier">t</span></code> metafunction class accepting one argument,
<code class="computeroutput"><span class="identifier">s</span></code> compile-time string and
<code class="computeroutput"><span class="identifier">pos</span></code> source position
</p>
<pre class="programlisting"><span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">transform</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">t</span><span class="special">&gt;::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span>
</pre>
<p>
is equivalent to
</p>
<pre class="programlisting"><span class="identifier">t</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">get_result</span><span class="special">&lt;</span><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">&gt;::</span><span class="identifier">type</span>
</pre>
<p>
When <code class="computeroutput"><span class="identifier">p</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">&gt;</span></code> doesn't return an error. The combinator
returns the error otherwise.
</p>
<h2>
<a name="metaparse.reference.alphabetical.transform.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.transform.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.transform.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">transform</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">digit</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">is_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">get_result</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">util</span><span class="special">/</span><span class="identifier">digit_to_int</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">digit_value</span> <span class="special">=</span> <span class="identifier">transform</span><span class="special">&lt;</span><span class="identifier">digit</span><span class="special">,</span> <span class="identifier">util</span><span class="special">::</span><span class="identifier">digit_to_int</span><span class="special">&lt;&gt;&gt;;</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="special">!</span><span class="identifier">is_error</span><span class="special">&lt;</span>
<span class="identifier">digit_value</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"0"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"digit_val should accept a digit"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">digit_value</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"x"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"digit_val should reject a character"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">get_result</span><span class="special">&lt;</span>
<span class="identifier">digit_value</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"0"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span> <span class="number">0</span><span class="special">,</span>
<span class="string">"the result of parsing should be the int value"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.unexpected_character"></a><a name="unexpected_character"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.unexpected_character" title="unexpected_character">unexpected_character</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.unexpected_character.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.unexpected_character.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.unexpected_character.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">error</span>
<span class="special">{</span>
<span class="keyword">struct</span> <span class="identifier">unexpected_character</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parsing_error_message">parsing error message</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.unexpected_character.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.unexpected_character.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.unexpected_character.description">Description</a>
</h2>
<p>
Class representing the error that a different character was expected than
what was found at a specific location.
</p>
<h2>
<a name="metaparse.reference.alphabetical.unexpected_character.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.unexpected_character.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.unexpected_character.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">error</span><span class="special">/</span><span class="identifier">unexpected_character</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.unexpected_end_of_input"></a><a name="unexpected_end_of_input"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.unexpected_end_of_input" title="unexpected_end_of_input">unexpected_end_of_input</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.unexpected_end_of_input.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.unexpected_end_of_input.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.unexpected_end_of_input.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">error</span>
<span class="special">{</span>
<span class="keyword">struct</span> <span class="identifier">unexpected_end_of_input</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parsing_error_message">parsing error message</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.unexpected_end_of_input.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.unexpected_end_of_input.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.unexpected_end_of_input.description">Description</a>
</h2>
<p>
Class representing the error that the end of input has been reached while
it should contain further characters.
</p>
<h2>
<a name="metaparse.reference.alphabetical.unexpected_end_of_input.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.unexpected_end_of_input.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.unexpected_end_of_input.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">error</span><span class="special">/</span><span class="identifier">unexpected_end_of_input</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.unless_error"></a><a name="unless_error"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.unless_error" title="unless_error">unless_error</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.unless_error.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.unless_error.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.unless_error.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">NotErrorCase</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">unless_error</span><span class="special">;</span>
</pre>
<p>
This is a <a class="link" href="reference.html#lazy_metafunction">lazy template metafunction</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.unless_error.arguments"></a><p class="title"><b>Table 24.87. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">T</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#accept">accept</a> or <a class="link" href="reference.html#reject">reject</a>
value
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">NotErrorCase</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a>
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.unless_error.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.unless_error.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.unless_error.description">Description</a>
</h2>
<p>
Checks if <code class="computeroutput"><span class="identifier">T</span></code> is a parsing
error or not. When it is, the result is <code class="computeroutput"><span class="identifier">T</span></code>.
When it is not, the result is <code class="computeroutput"><span class="identifier">NotErrorCase</span></code>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.unless_error.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.unless_error.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.unless_error.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">unless_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.unless_error.h3"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.unless_error.expression_semantics"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.unless_error.expression_semantics">Expression
semantics</a>
</h2>
<p>
For any <code class="computeroutput"><span class="identifier">t</span></code> and <code class="computeroutput"><span class="identifier">c</span></code> classes the following are equivalent:
</p>
<pre class="programlisting"><span class="identifier">unless_error</span><span class="special">&lt;</span><span class="identifier">t</span><span class="special">,</span> <span class="identifier">c</span><span class="special">&gt;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">if_</span><span class="special">&lt;</span><span class="identifier">is_error</span><span class="special">&lt;</span><span class="identifier">t</span><span class="special">::</span><span class="identifier">type</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span> <span class="identifier">t</span><span class="special">,</span> <span class="identifier">c</span><span class="special">&gt;</span>
</pre>
<h2>
<a name="metaparse.reference.alphabetical.unless_error.h4"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.unless_error.example"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.unless_error.example">Example</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">unless_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">accept</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">reject</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">define_error</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">metaparse</span><span class="special">;</span>
<span class="identifier">BOOST_METAPARSE_DEFINE_ERROR</span><span class="special">(</span><span class="identifier">sample_error</span><span class="special">,</span> <span class="string">"Sample error message"</span><span class="special">);</span>
<span class="keyword">using</span> <span class="identifier">accept1</span> <span class="special">=</span>
<span class="identifier">accept</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">11</span><span class="special">&gt;,</span> <span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"foo"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">accept2</span> <span class="special">=</span>
<span class="identifier">accept</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="number">13</span><span class="special">&gt;,</span> <span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"bar"</span><span class="special">),</span> <span class="identifier">start</span><span class="special">&gt;;</span>
<span class="keyword">using</span> <span class="identifier">reject1</span> <span class="special">=</span> <span class="identifier">reject</span><span class="special">&lt;</span><span class="identifier">sample_error</span><span class="special">,</span> <span class="identifier">start</span><span class="special">&gt;;</span>
<span class="keyword">struct</span> <span class="identifier">returns_accept1</span> <span class="special">{</span> <span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span> <span class="identifier">accept1</span><span class="special">;</span> <span class="special">};</span>
<span class="keyword">struct</span> <span class="identifier">returns_accept2</span> <span class="special">{</span> <span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span> <span class="identifier">accept2</span><span class="special">;</span> <span class="special">};</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span><span class="identifier">accept2</span><span class="special">,</span> <span class="identifier">unless_error</span><span class="special">&lt;</span><span class="identifier">accept1</span><span class="special">,</span> <span class="identifier">accept2</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it returns the second argument when the first argument is an accept"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span><span class="identifier">reject1</span><span class="special">,</span> <span class="identifier">unless_error</span><span class="special">&lt;</span><span class="identifier">reject1</span><span class="special">,</span> <span class="identifier">accept2</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it returns the first argument when that is a reject"</span>
<span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
<span class="identifier">accept2</span><span class="special">,</span>
<span class="identifier">unless_error</span><span class="special">&lt;</span><span class="identifier">returns_accept1</span><span class="special">,</span> <span class="identifier">returns_accept2</span><span class="special">&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"it supports lazy evaluation"</span>
<span class="special">);</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.unpaired"></a><a name="unpaired"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.unpaired" title="unpaired">unpaired</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.unpaired.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.unpaired.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.unpaired.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">error</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">int</span> <span class="identifier">Line</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">Col</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Msg</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">na</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">unpaired</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parsing_error_message">parsing error message</a>.
</p>
<div class="table">
<a name="metaparse.reference.alphabetical.unpaired.arguments"></a><p class="title"><b>Table 24.88. Arguments</b></p>
<div class="table-contents"><table class="table" summary="Arguments">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Type
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Line</span></code>
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="keyword">int</span></code> value
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Col</span></code>
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="keyword">int</span></code> value
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">Msg</span></code>
</p>
</td>
<td>
<p>
<a class="link" href="reference.html#metaprogramming_value">template metaprogramming
value</a>
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h2>
<a name="metaparse.reference.alphabetical.unpaired.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.unpaired.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.unpaired.description">Description</a>
</h2>
<p>
Template class representing the error that the closing element of an "<span class="emphasis"><em>opening
element</em></span> ... <span class="emphasis"><em>closing element</em></span>" structure
is missing. (eg. a closing paren is missing). <code class="computeroutput"><span class="identifier">Line</span></code>
and <code class="computeroutput"><span class="identifier">Col</span></code> point to the beginning
of the <span class="emphasis"><em>opening element</em></span> (eg. the opening paren). <code class="computeroutput"><span class="identifier">Msg</span></code> is the error message the parser trying
to parse the <span class="emphasis"><em>closing element</em></span> failed with.
</p>
<p>
It supports currying: <code class="computeroutput"><span class="identifier">unpaired</span><span class="special">&lt;</span><span class="identifier">Line</span><span class="special">,</span> <span class="identifier">Col</span><span class="special">&gt;</span></code> is a <a class="link" href="reference.html#metafunction_class">template
metafunction class</a> taking one argument: the <code class="computeroutput"><span class="identifier">Msg</span></code>
element and returning the corresponding <code class="computeroutput"><span class="identifier">unpaired</span></code>
value.
</p>
<h2>
<a name="metaparse.reference.alphabetical.unpaired.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.unpaired.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.unpaired.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">error</span><span class="special">/</span><span class="identifier">unpaired</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.reference.alphabetical.whitespace_expected"></a><a name="whitespace_expected"></a><a class="link" href="reference.html#metaparse.reference.alphabetical.whitespace_expected" title="whitespace_expected">whitespace_expected</a>
</h4></div></div></div>
<h2>
<a name="metaparse.reference.alphabetical.whitespace_expected.h0"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.whitespace_expected.synopsis"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.whitespace_expected.synopsis">Synopsis</a>
</h2>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">error</span>
<span class="special">{</span>
<span class="keyword">struct</span> <span class="identifier">whitespace_expected</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
This is a <a class="link" href="reference.html#parsing_error_message">parsing error message</a>.
</p>
<h2>
<a name="metaparse.reference.alphabetical.whitespace_expected.h1"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.whitespace_expected.description"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.whitespace_expected.description">Description</a>
</h2>
<p>
Class representing the error that a whitespace character was expected at
a specific location.
</p>
<h2>
<a name="metaparse.reference.alphabetical.whitespace_expected.h2"></a>
<span class="phrase"><a name="metaparse.reference.alphabetical.whitespace_expected.header"></a></span><a class="link" href="reference.html#metaparse.reference.alphabetical.whitespace_expected.header">Header</a>
</h2>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">metaparse</span><span class="special">/</span><span class="identifier">error</span><span class="special">/</span><span class="identifier">whitespace_expected</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2015 Abel Sinkovics<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="the_design_of_the_library.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../metaparse.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../move.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>