1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>http::parser::parser (5 of 5 overloads)</title> 5<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../../../../index.html" title="Chapter 1. Boost.Beast"> 8<link rel="up" href="../parser.html" title="http::parser::parser"> 9<link rel="prev" href="overload4.html" title="http::parser::parser (4 of 5 overloads)"> 10<link rel="next" href="../operator_eq_.html" title="http::parser::operator="> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td> 15<td align="center"><a href="../../../../../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="overload4.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../parser.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="../operator_eq_.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h6 class="title"> 27<a name="beast.ref.boost__beast__http__parser.parser.overload5"></a><a class="link" href="overload5.html" title="http::parser::parser (5 of 5 overloads)">http::parser::parser 28 (5 of 5 overloads)</a> 29</h6></div></div></div> 30<p> 31 Construct a parser from another parser, changing the Body type. 32 </p> 33<h7><a name="beast.ref.boost__beast__http__parser.parser.overload5.h0"></a> 34 <span class="phrase"><a name="beast.ref.boost__beast__http__parser.parser.overload5.synopsis"></a></span><a class="link" href="overload5.html#beast.ref.boost__beast__http__parser.parser.overload5.synopsis">Synopsis</a> 35 </h7><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span> 36 <span class="keyword">class</span> <span class="identifier">OtherBody</span><span class="special">,</span> 37 <span class="keyword">class</span><span class="special">...</span> <span class="identifier">Args</span><span class="special">></span> 38<span class="identifier">parser</span><span class="special">(</span> 39 <span class="identifier">parser</span><span class="special"><</span> <span class="identifier">isRequest</span><span class="special">,</span> <span class="identifier">OtherBody</span><span class="special">,</span> <span class="identifier">Allocator</span> <span class="special">>&&</span> <span class="identifier">parser</span><span class="special">,</span> 40 <span class="identifier">Args</span><span class="special">&&...</span> <span class="identifier">args</span><span class="special">);</span> 41</pre> 42<h7><a name="beast.ref.boost__beast__http__parser.parser.overload5.h1"></a> 43 <span class="phrase"><a name="beast.ref.boost__beast__http__parser.parser.overload5.description"></a></span><a class="link" href="overload5.html#beast.ref.boost__beast__http__parser.parser.overload5.description">Description</a> 44 </h7><p> 45 This constructs a new parser by move constructing the header from another 46 parser with a different body type. The constructed-from parser must not 47 have any parsed body octets or initialized <span class="emphasis"><em>BodyReader</em></span>, 48 otherwise an exception is generated. 49 </p> 50<h7><a name="beast.ref.boost__beast__http__parser.parser.overload5.h2"></a> 51 <span class="phrase"><a name="beast.ref.boost__beast__http__parser.parser.overload5.example"></a></span><a class="link" href="overload5.html#beast.ref.boost__beast__http__parser.parser.overload5.example">Example</a> 52 </h7><pre class="programlisting"><span class="comment">// Deferred body type commitment</span> 53<span class="identifier">request_parser</span><span class="special"><</span><span class="identifier">empty_body</span><span class="special">></span> <span class="identifier">req0</span><span class="special">;</span> 54<span class="special">...</span> 55<span class="identifier">request_parser</span><span class="special"><</span><span class="identifier">string_body</span><span class="special">></span> <span class="identifier">req</span><span class="special">{</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">req0</span><span class="special">)};</span> 56</pre> 57<p> 58 If an exception is thrown, the state of the constructed-from parser is 59 undefined. 60 </p> 61<h7><a name="beast.ref.boost__beast__http__parser.parser.overload5.h3"></a> 62 <span class="phrase"><a name="beast.ref.boost__beast__http__parser.parser.overload5.parameters"></a></span><a class="link" href="overload5.html#beast.ref.boost__beast__http__parser.parser.overload5.parameters">Parameters</a> 63 </h7><div class="informaltable"><table class="table"> 64<colgroup> 65<col> 66<col> 67</colgroup> 68<thead><tr> 69<th> 70 <p> 71 Name 72 </p> 73 </th> 74<th> 75 <p> 76 Description 77 </p> 78 </th> 79</tr></thead> 80<tbody> 81<tr> 82<td> 83 <p> 84 <code class="computeroutput"><span class="identifier">parser</span></code> 85 </p> 86 </td> 87<td> 88 <p> 89 The other parser to construct from. After this call returns, 90 the constructed-from parser may only be destroyed. 91 </p> 92 </td> 93</tr> 94<tr> 95<td> 96 <p> 97 <code class="computeroutput"><span class="identifier">args</span></code> 98 </p> 99 </td> 100<td> 101 <p> 102 Optional arguments forwarded to the message constructor. 103 </p> 104 </td> 105</tr> 106</tbody> 107</table></div> 108<h7><a name="beast.ref.boost__beast__http__parser.parser.overload5.h4"></a> 109 <span class="phrase"><a name="beast.ref.boost__beast__http__parser.parser.overload5.exceptions"></a></span><a class="link" href="overload5.html#beast.ref.boost__beast__http__parser.parser.overload5.exceptions">Exceptions</a> 110 </h7><div class="informaltable"><table class="table"> 111<colgroup> 112<col> 113<col> 114</colgroup> 115<thead><tr> 116<th> 117 <p> 118 Type 119 </p> 120 </th> 121<th> 122 <p> 123 Thrown On 124 </p> 125 </th> 126</tr></thead> 127<tbody><tr> 128<td> 129 <p> 130 <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">invalid_argument</span></code> 131 </p> 132 </td> 133<td> 134 <p> 135 Thrown when the constructed-from parser has already initialized 136 a body reader. 137 </p> 138 </td> 139</tr></tbody> 140</table></div> 141<h7><a name="beast.ref.boost__beast__http__parser.parser.overload5.h5"></a> 142 <span class="phrase"><a name="beast.ref.boost__beast__http__parser.parser.overload5.remarks"></a></span><a class="link" href="overload5.html#beast.ref.boost__beast__http__parser.parser.overload5.remarks">Remarks</a> 143 </h7><p> 144 This function participates in overload resolution only if the other parser 145 uses a different body type. 146 </p> 147</div> 148<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 149<td align="left"></td> 150<td align="right"><div class="copyright-footer">Copyright © 2016-2019 Vinnie 151 Falco<p> 152 Distributed under the Boost Software License, Version 1.0. (See accompanying 153 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>) 154 </p> 155</div></td> 156</tr></table> 157<hr> 158<div class="spirit-nav"> 159<a accesskey="p" href="overload4.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../parser.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="../operator_eq_.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> 160</div> 161</body> 162</html> 163