Fix message constructor and special members

fix #196
This commit is contained in:
Vinnie Falco
2016-11-20 07:35:27 -05:00
parent d24190cfdf
commit 133d926e2f
3 changed files with 41 additions and 3 deletions

View File

@@ -1,3 +1,14 @@
1.0.0-b23
* Tune websocket echo server for performance
* Add file and line number to thrown exceptions
* Better logging in async echo server
* Add copy special members
* Fix message constructor and special members
* Travis CI improvements
--------------------------------------------------------------------------------
1.0.0-b22 1.0.0-b22
* Fix broken Intellisense * Fix broken Intellisense

View File

@@ -246,6 +246,18 @@ struct message : header<isRequest, Fields>
/// Default constructor /// Default constructor
message() = default; message() = default;
/// Move constructor
message(message&&) = default;
/// Copy constructor
message(message const&) = default;
/// Move assignment
message& operator=(message&&) = default;
/// Copy assignment
message& operator=(message const&) = default;
/** Construct a message from a header. /** Construct a message from a header.
Additional arguments, if any, are forwarded to Additional arguments, if any, are forwarded to
@@ -281,8 +293,9 @@ struct message : header<isRequest, Fields>
*/ */
template<class U template<class U
#if ! GENERATING_DOCS #if ! GENERATING_DOCS
, class = typename std::enable_if<! std::is_convertible< , class = typename std::enable_if<
typename std::decay<U>::type, base_type>::value> ! std::is_convertible<typename
std::decay<U>::type, base_type>::value>::type
#endif #endif
> >
explicit explicit
@@ -303,7 +316,7 @@ struct message : header<isRequest, Fields>
template<class U, class V template<class U, class V
#if ! GENERATING_DOCS #if ! GENERATING_DOCS
,class = typename std::enable_if<! std::is_convertible< ,class = typename std::enable_if<! std::is_convertible<
typename std::decay<U>::type, base_type>::value> typename std::decay<U>::type, base_type>::value>::type
#endif #endif
> >
message(U&& u, V&& v) message(U&& u, V&& v)

View File

@@ -278,6 +278,19 @@ public:
BEAST_EXPECT(m2.fields.exists("h")); BEAST_EXPECT(m2.fields.exists("h"));
} }
void
testSpecialMembers()
{
response<string_body> r1;
response<string_body> r2{r1};
response<string_body> r3{std::move(r2)};
r2 = r3;
r1 = std::move(r2);
[r1]()
{
}();
}
void run() override void run() override
{ {
testMessage(); testMessage();
@@ -285,6 +298,7 @@ public:
testFreeFunctions(); testFreeFunctions();
testPrepare(); testPrepare();
testSwap(); testSwap();
testSpecialMembers();
} }
}; };