[vlc-devel] [vlc-commits] Provide a default move ctor & assignment operator for challenged compilers
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Fri Apr 3 16:58:46 CEST 2015
On Fri, Apr 3, 2015, at 04:53 PM, Tristan Matthews wrote:
> On Fri, Apr 3, 2015 at 7:09 AM, Hugo Beauzée-Luyssen <git at videolan.org>
> wrote:
> > 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;
> > + }
>
> You need return *this at the end also, no?
>
Definitely. Thanks for spotting!
Regards,
--
Hugo Beauzée-Luyssen
hugo at beauzee.fr
More information about the vlc-devel
mailing list