parser is constructible from other body types

This commit is contained in:
Vinnie Falco
2017-06-05 16:09:38 -07:00
parent d89809fb45
commit a007eba09c
6 changed files with 237 additions and 50 deletions
+17
View File
@@ -8,6 +8,9 @@
#ifndef BEAST_HTTP_IMPL_PARSER_IPP
#define BEAST_HTTP_IMPL_PARSER_IPP
#include <boost/throw_exception.hpp>
#include <stdexcept>
namespace beast {
namespace http {
@@ -29,6 +32,20 @@ parser(Arg1&& arg1, ArgN&&... argn)
{
}
template<bool isRequest, class Body, class Fields>
template<class OtherBody, class... Args>
parser<isRequest, Body, Fields>::
parser(parser<isRequest, OtherBody, Fields>&& parser,
Args&&... args)
: base_type(std::move(parser))
, m_(parser.release().base(),
std::forward<Args>(args)...)
{
if(parser.wr_)
BOOST_THROW_EXCEPTION(std::invalid_argument{
"moved-from parser has a body"});
}
template<bool isRequest, class Body, class Fields>
template<class... Args>
parser<isRequest, Body, Fields>::