forked from boostorg/beast
parser is constructible from other body types
This commit is contained in:
@@ -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>::
|
||||
|
||||
Reference in New Issue
Block a user