[vlc-commits] Provide a default move ctor & assignment operator for challenged compilers
Hugo Beauzée-Luyssen
git at videolan.org
Fri Apr 3 13:09:47 CEST 2015
npapi-vlc | branch: cleanup | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Apr 3 10:31:26 2015 +0200| [f9aa81a49e7c53e1fc6f646c773ca091386bcde1] | committer: Hugo Beauzée-Luyssen
Provide a default move ctor & assignment operator for challenged compilers
> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=f9aa81a49e7c53e1fc6f646c773ca091386bcde1
---
npapi/utils.hpp | 30 ++++++++++++++++++++++++++++--
npapi/vlcplugin_base.cpp | 9 +++++++++
2 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/npapi/utils.hpp b/npapi/utils.hpp
index f741ed8..1f55544 100644
--- a/npapi/utils.hpp
+++ b/npapi/utils.hpp
@@ -494,7 +494,14 @@ public:
return *this;
}
+#ifndef _MSC_VER
Variant(Variant&& v) = default;
+#else
+ Variant(Variant&& v)
+ : m_variant( std::move( v.m_variant ) )
+ {
+ }
+#endif
Variant& operator=(Variant&& v)
{
@@ -647,8 +654,27 @@ public:
return m_size;
}
- VariantArray(const Variant&) = delete;
- VariantArray& operator=(const Variant&) = delete;
+ VariantArray(const VariantArray&) = delete;
+ VariantArray& operator=(const VariantArray&) = delete;
+#ifndef _MSC_VER
+ VariantArray(VariantArray&&) = default;
+ VariantArray& operator=(VariantArray&&) = default;
+#else
+ VariantArray(VariantArray&& v)
+ : m_variants(std::move( v.m_variants ) )
+ , m_size( v.m_size )
+ {
+ }
+
+ VariantArray& operator=(VariantArray&& v)
+ {
+ if (&v == this)
+ return *this;
+ m_variants = std::move(v.m_variants);
+ m_size = v.m_size;
+ }
+
+#endif
private:
VPtr m_variants;
size_t m_size;
diff --git a/npapi/vlcplugin_base.cpp b/npapi/vlcplugin_base.cpp
index 89cf69d..67b8c1c 100644
--- a/npapi/vlcplugin_base.cpp
+++ b/npapi/vlcplugin_base.cpp
@@ -304,7 +304,16 @@ public:
}
CallbackClosure(const CallbackClosure&) = delete;
+
+#ifndef _MSC_VER
CallbackClosure(CallbackClosure&&) = default;
+#else
+ CallbackClosure(CallbackClosure&& c)
+ : _browser( std::move(c._browser) )
+ , _listener( std::move(c._listener) )
+ {
+ }
+#endif
template <typename... Args>
void operator()(Args&&... params) const
More information about the vlc-commits
mailing list