Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix special members for http classes #534

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 20 additions & 19 deletions src/beast/beast/http/headers.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,18 @@ class headers : private detail::less

headers() = default;

template <class = void>
#if defined(_MSC_VER) && _MSC_VER <= 1800
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a nod to non-experts, like myself, I think it would be good to include a comment justifying the #if. Identify the missing feature in VS that you're working around. You already know. Future developers will have to look it up.

headers (headers&& other);
headers& operator= (headers&& other);

template <class = void>
headers (headers const& other);
#else
headers (headers&& other) = default;
headers& operator= (headers&& other) = default;

template <class = void>
headers&
operator= (headers&& other);
#endif

template <class = void>
headers&
operator= (headers const& other);
headers (headers const& other);
headers& operator= (headers const& other);

/** Returns an iterator to headers in order of appearance. */
/** @{ */
Expand Down Expand Up @@ -184,31 +183,33 @@ less::operator() (

//------------------------------------------------------------------------------

template <class>
#if defined(_MSC_VER) && _MSC_VER <= 1800
inline
headers::headers (headers&& other)
: list_ (std::move(other.list_))
, set_ (std::move(other.set_))
{

}

template <class>
headers::headers (headers const& other)
{
for (auto const& e : other.list_)
append (e.field, e.value);
}

template <class>
inline
headers&
headers::operator= (headers&& other)
{
list_ = std::move(other.list_);
set_ = std::move(other.set_);
return *this;
}
#endif

template <class>
inline
headers::headers (headers const& other)
{
for (auto const& e : other.list_)
append (e.field, e.value);
}

inline
headers&
headers::operator= (headers const& other)
{
Expand Down
19 changes: 12 additions & 7 deletions src/beast/beast/http/message.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,18 @@ class message
template <class = void>
message();

template <class = void>
#if defined(_MSC_VER) && _MSC_VER <= 1800
message (message&& other);

template <class = void>
message& operator= (message&& other);

// Memberspace
beast::http::headers headers;
#else
message (message&& other) = default;
message& operator= (message&& other) = default;

#endif

// Memberspaces
beast::http::headers headers;
beast::http::body body;

bool
Expand Down Expand Up @@ -198,7 +201,8 @@ message::message()
{
}

template <class>
#if defined(_MSC_VER) && _MSC_VER <= 1800
inline
message::message (message&& other)
: request_ (other.request_)
, method_ (std::move(other.method_))
Expand All @@ -213,7 +217,7 @@ message::message (message&& other)
{
}

template <class>
inline
message&
message::operator= (message&& other)
{
Expand All @@ -229,6 +233,7 @@ message::operator= (message&& other)
body = std::move(other.body);
return *this;
}
#endif

//------------------------------------------------------------------------------

Expand Down
14 changes: 10 additions & 4 deletions src/beast/beast/http/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@ class parser : public beast::http::basic_parser
message_.get().request(request);
}

template <class = void>
parser&
operator= (parser&& other);
#if defined(_MSC_VER) && _MSC_VER <= 1800
parser& operator= (parser&& other);

#else
parser& operator= (parser&& other) = default;

#endif

private:
template <class = void>
Expand Down Expand Up @@ -118,14 +122,16 @@ class parser : public beast::http::basic_parser

//------------------------------------------------------------------------------

template <class>
#if defined(_MSC_VER) && _MSC_VER <= 1800
inline
parser&
parser::operator= (parser&& other)
{
basic_parser::operator= (std::move(other));
message_ = std::move (other.message_);
return *this;
}
#endif

template <class>
void
Expand Down