forked from boostorg/beast
Refactor message and message_headers declarations:
message_headers is now a set of partial class template specializations instead of a template class alias. This solves a problem where template functions taking message_headers as a parameter could not deduce argument types, since std::conditional obscured the deduced context. Both classes are refactored to share declarations using an #ifdef, to eliminate an ugly set of extra declarations needed when building the documentation. Copy and move class special members are added. A new function message::base() is provided which returns the message_headers portion of a message.
This commit is contained in:
1 parent
9fd8aede3d
commit
f6dd744fd1
8 files changed
+349
-228
No files matched your search
@@ -20,6 +20,43 @@
|
||||
namespace beast {
|
||||
namespace http {
|
||||
|
||||
template<class Headers>
|
||||
void
|
||||
swap(
|
||||
message_headers<true, Headers>& m1,
|
||||
message_headers<true, Headers>& m2)
|
||||
{
|
||||
using std::swap;
|
||||
swap(m1.version, m2.version);
|
||||
swap(m1.method, m2.method);
|
||||
swap(m1.url, m2.url);
|
||||
swap(m1.headers, m2.headers);
|
||||
}
|
||||
|
||||
template<class Headers>
|
||||
void
|
||||
swap(
|
||||
message_headers<false, Headers>& a,
|
||||
message_headers<false, Headers>& b)
|
||||
{
|
||||
using std::swap;
|
||||
swap(a.version, b.version);
|
||||
swap(a.status, b.status);
|
||||
swap(a.reason, b.reason);
|
||||
swap(a.headers, b.headers);
|
||||
}
|
||||
|
||||
template<bool isRequest, class Body, class Headers>
|
||||
void
|
||||
swap(
|
||||
message<isRequest, Body, Headers>& m1,
|
||||
message<isRequest, Body, Headers>& m2)
|
||||
{
|
||||
using std::swap;
|
||||
swap(m1.base(), m2.base());
|
||||
swap(m1.body, m2.body);
|
||||
}
|
||||
|
||||
template<bool isRequest, class Body, class Headers>
|
||||
bool
|
||||
is_keep_alive(message<isRequest, Body, Headers> const& msg)
|
||||
|
||||
Reference in new issue
Block a user