From a8fd9f668f39cd2fcffb390919faa492bf0ef888 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Wed, 24 Jan 2018 12:25:30 +0200 Subject: [PATCH] ASE: Explicitly write out Material move constructor and assignment operator Because MSVC doesn't support defaulting them --- code/ASEParser.h | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/code/ASEParser.h b/code/ASEParser.h index e079c4931..843cec6ab 100644 --- a/code/ASEParser.h +++ b/code/ASEParser.h @@ -80,10 +80,36 @@ struct Material : public D3DS::Material Material(const Material &other) = default; - Material(Material &&other) = default; - Material &operator=(const Material &other) = default; - Material &operator=(Material &&other) = default; + + + //! Move constructor. This is explicitly written because MSVC doesn't support defaulting it + Material(Material &&other) + : D3DS::Material(std::move(other)) + , avSubMaterials(std::move(other.avSubMaterials)) + , pcInstance(std::move(other.pcInstance)) + , bNeed(std::move(other.bNeed)) + { + other.pcInstance = nullptr; + } + + + Material &operator=(Material &&other) { + if (this == &other) { + return *this; + } + + D3DS::Material::operator=(std::move(other)); + + avSubMaterials = std::move(other.avSubMaterials); + pcInstance = std::move(other.pcInstance); + bNeed = std::move(other.bNeed); + + other.pcInstance = nullptr; + + return *this; + } + ~Material() {}