diff --git a/webcc/globals.h b/webcc/globals.h index 2dec6cd..3e908f9 100644 --- a/webcc/globals.h +++ b/webcc/globals.h @@ -6,6 +6,18 @@ // ----------------------------------------------------------------------------- // Macros +// Does the compiler support "= default" for move copy constructor and +// assignment operator? +#ifdef _MSC_VER + #if _MSC_VER <= 1800 // VS 2013 + #define WEBCC_DEFAULT_MOVE_COPY_ASSIGN 0 + #else + #define WEBCC_DEFAULT_MOVE_COPY_ASSIGN 1 + #endif // _MSC_VER <= 1800 +#else + #define WEBCC_DEFAULT_MOVE_COPY_ASSIGN 1 +#endif // _MSC_VER + // Explicitly declare the copy constructor and assignment operator as deleted. #define DELETE_COPY_AND_ASSIGN(TypeName) \ TypeName(const TypeName&) = delete; \ diff --git a/webcc/soap_parameter.h b/webcc/soap_parameter.h index 0c04d80..720827b 100644 --- a/webcc/soap_parameter.h +++ b/webcc/soap_parameter.h @@ -3,6 +3,8 @@ #include +#include "webcc/globals.h" // for COPY_ASSIGN_MOVE_DEFAULT + namespace webcc { // Key-value SOAP parameter. @@ -44,10 +46,17 @@ class SoapParameter { as_cdata_(false) { } +#if WEBCC_DEFAULT_MOVE_COPY_ASSIGN + + SoapParameter(SoapParameter&&) = default; + SoapParameter& operator=(SoapParameter&&) = default; + +#else + // Use "= default" if drop the support of VS 2013. SoapParameter(SoapParameter&& rhs) : key_(std::move(rhs.key_)), value_(std::move(rhs.value_)), - as_cdata_(rhs.as_cdata_) { + as_cdata_(rhs.as_cdata_) { } // Use "= default" if drop the support of VS 2013. @@ -60,6 +69,8 @@ class SoapParameter { return *this; } +#endif // WEBCC_DEFAULT_MOVE_COPY_ASSIGN + const std::string& key() const { return key_; } const std::string& value() const { return value_; }