Skip to content

Commit a159e4e

Browse files
garethsbras0219-msft
authored andcommitted
Fix VS2013 compilation errors (microsoft#678)
* Revert explicitly defaulted move constructors and assignment operators (part of commit b063472) to restore compatibility with VS2013 (fix microsoft#674) * Simplify and make consistent use of member typedefs in basic_istream and the type_parser hierarchy, which also fixes microsoft#675 * Restore EOL: Unix (seems to have been EOL: Mixed at commit 3e8dcf5) * Add comments explicitly indicating suboptimal code for VS2013 compat
1 parent 6397261 commit a159e4e

File tree

2 files changed

+117
-51
lines changed

2 files changed

+117
-51
lines changed

Release/include/cpprest/base_uri.h

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,32 @@ namespace web {
3232
uri_components(const uri_components &other) = default;
3333
uri_components & operator=(const uri_components &other) = default;
3434

35-
uri_components(uri_components &&other) = default;
36-
uri_components & operator=(uri_components &&other) = default;
35+
// This is for VS2013 compatibility -- replace with '= default' when VS2013 is completely dropped.
36+
uri_components(uri_components &&other) CPPREST_NOEXCEPT :
37+
m_scheme(std::move(other.m_scheme)),
38+
m_host(std::move(other.m_host)),
39+
m_user_info(std::move(other.m_user_info)),
40+
m_path(std::move(other.m_path)),
41+
m_query(std::move(other.m_query)),
42+
m_fragment(std::move(other.m_fragment)),
43+
m_port(other.m_port)
44+
{}
45+
46+
// This is for VS2013 compatibility -- replace with '= default' when VS2013 is completely dropped.
47+
uri_components & operator=(uri_components &&other) CPPREST_NOEXCEPT
48+
{
49+
if (this != &other)
50+
{
51+
m_scheme = std::move(other.m_scheme);
52+
m_host = std::move(other.m_host);
53+
m_user_info = std::move(other.m_user_info);
54+
m_path = std::move(other.m_path);
55+
m_query = std::move(other.m_query);
56+
m_fragment = std::move(other.m_fragment);
57+
m_port = other.m_port;
58+
}
59+
return *this;
60+
}
3761

3862
_ASYNCRTIMP utility::string_t join();
3963

@@ -195,12 +219,25 @@ namespace web {
195219
/// <summary>
196220
/// Move constructor.
197221
/// </summary>
198-
uri(uri &&other) = default;
222+
// This is for VS2013 compatibility -- replace with '= default' when VS2013 is completely dropped.
223+
uri(uri &&other) CPPREST_NOEXCEPT :
224+
m_uri(std::move(other.m_uri)),
225+
m_components(std::move(other.m_components))
226+
{}
199227

200228
/// <summary>
201229
/// Move assignment operator
202230
/// </summary>
203-
uri & operator=(uri &&other) = default;
231+
// This is for VS2013 compatibility -- replace with '= default' when VS2013 is completely dropped.
232+
uri & operator=(uri &&other) CPPREST_NOEXCEPT
233+
{
234+
if (this != &other)
235+
{
236+
m_uri = std::move(other.m_uri);
237+
m_components = std::move(other.m_components);
238+
}
239+
return *this;
240+
}
204241

205242
/// <summary>
206243
/// Get the scheme component of the URI as an encoded string.

0 commit comments

Comments
 (0)