From 6c606b5506a36127271f1da6b1e85413a126c77f Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 25 Dec 2021 17:06:12 -0500 Subject: [PATCH] Fix through route to `TargetPlatform::TypeDistinguisher`. --- Storage/Disk/DiskImage/DiskImage.hpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Storage/Disk/DiskImage/DiskImage.hpp b/Storage/Disk/DiskImage/DiskImage.hpp index ed051756f..d12d4709a 100644 --- a/Storage/Disk/DiskImage/DiskImage.hpp +++ b/Storage/Disk/DiskImage/DiskImage.hpp @@ -14,6 +14,7 @@ #include "../Disk.hpp" #include "../Track/Track.hpp" +#include "../../TargetPlatforms.hpp" namespace Storage { namespace Disk { @@ -86,8 +87,11 @@ class DiskImageHolderBase: public Disk { Provides a wrapper that wraps a DiskImage to make it into a Disk, providing caching and, thereby, an intermediate store for modified tracks so that mutable disk images can either update on the fly or perform a block update on closure, as appropriate. + + Implements TargetPlatform::TypeDistinguisher to return either no information whatsoever, if + the underlying image doesn't implement TypeDistinguisher, or else to pass the call along. */ -template class DiskImageHolder: public DiskImageHolderBase { +template class DiskImageHolder: public DiskImageHolderBase, public TargetPlatform::TypeDistinguisher { public: template DiskImageHolder(Ts&&... args) : disk_image_(args...) {} @@ -103,6 +107,14 @@ template class DiskImageHolder: public DiskImageHolderBase { private: T disk_image_; + + TargetPlatform::Type target_platform_type() final { + if constexpr (std::is_base_of::value) { + return static_cast(&disk_image_)->target_platform_type(); + } else { + return TargetPlatform::Type(~0); + } + } }; #include "DiskImageImplementation.hpp"