From ae7d90fc9c864bd0ad583421956b196f47f02f33 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 15 Jul 2024 11:48:11 +0100 Subject: [PATCH] Added virtual destructors to ABCs --- .../include/amulet_nbt/tag/wrapper.hpp | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp b/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp index 75a0ec05..4c88b5ed 100644 --- a/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp +++ b/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp @@ -15,17 +15,30 @@ namespace Amulet { class AbstractBaseTag { public: + virtual ~AbstractBaseTag() = default; virtual std::string to_nbt(std::string, std::endian, Amulet::StringEncode) const = 0; virtual std::string to_snbt() const = 0; virtual std::string to_snbt(const std::string& indent) const = 0; }; - class AbstractBaseImmutableTag: public AbstractBaseTag {}; - class AbstractBaseMutableTag: public AbstractBaseTag {}; - class AbstractBaseNumericTag: public AbstractBaseImmutableTag {}; - class AbstractBaseIntTag: public AbstractBaseNumericTag {}; - class AbstractBaseFloatTag: public AbstractBaseNumericTag {}; - class AbstractBaseArrayTag: public AbstractBaseMutableTag {}; + class AbstractBaseImmutableTag: public AbstractBaseTag { + virtual ~AbstractBaseImmutableTag() = default; + }; + class AbstractBaseMutableTag: public AbstractBaseTag { + virtual ~AbstractBaseMutableTag() = default; + }; + class AbstractBaseNumericTag: public AbstractBaseImmutableTag { + virtual ~AbstractBaseNumericTag() = default; + }; + class AbstractBaseIntTag: public AbstractBaseNumericTag { + virtual ~AbstractBaseIntTag() = default; + }; + class AbstractBaseFloatTag: public AbstractBaseNumericTag { + virtual ~AbstractBaseFloatTag() = default; + }; + class AbstractBaseArrayTag: public AbstractBaseMutableTag { + virtual ~AbstractBaseArrayTag() = default; + }; // pybind cannot directly store fundamental types // This wrapper exists to allow pybind to store fundamental types