From bf2a84b67cf85054ec65039d9cbe28664f34e0d6 Mon Sep 17 00:00:00 2001 From: Mathew Sutcliffe Date: Sun, 24 Apr 2016 16:26:58 +0100 Subject: [PATCH] refs #614, allow CCached::NotifySlot to refer to a base class method --- src/blackmisc/simulation/data/modelcaches.h | 2 +- src/blackmisc/valuecache.h | 2 +- src/blackmisc/valuecacheprivate.h | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/blackmisc/simulation/data/modelcaches.h b/src/blackmisc/simulation/data/modelcaches.h index 2f8e9be09..854040050 100644 --- a/src/blackmisc/simulation/data/modelcaches.h +++ b/src/blackmisc/simulation/data/modelcaches.h @@ -202,7 +202,7 @@ namespace BlackMisc BlackMisc::CData m_modelCacheFs9 {this, &CModelCaches::changedFs9 }; //!< FS9 cache BlackMisc::CData m_modelCacheP3D {this, &CModelCaches::changedP3D }; //!< P3D cache BlackMisc::CData m_modelCacheXP {this, &CModelCaches::changedXP }; //!< XP cache - BlackMisc::CData m_currentSimulator {this }; //!< surrent simulator + BlackMisc::CData m_currentSimulator { this }; //!< current simulator }; //! Bundle of caches for model sets of all simulators diff --git a/src/blackmisc/valuecache.h b/src/blackmisc/valuecache.h index c7b2f2b6f..e614f7f3f 100644 --- a/src/blackmisc/valuecache.h +++ b/src/blackmisc/valuecache.h @@ -271,7 +271,7 @@ namespace BlackMisc //! Type of pointer to non-const member function of U taking no arguments and returning void, //! for slot parameter of CCached constructor. template - using NotifySlot = void (U::*)(); + using NotifySlot = Private::NonDeduced; //! Constructor. //! \param cache The CValueCache object which manages the value. diff --git a/src/blackmisc/valuecacheprivate.h b/src/blackmisc/valuecacheprivate.h index 56a0bb884..9a23f522c 100644 --- a/src/blackmisc/valuecacheprivate.h +++ b/src/blackmisc/valuecacheprivate.h @@ -27,6 +27,21 @@ namespace BlackMisc namespace Private { + /*! + * \private Identity type trait. + */ + template + struct Identity + { + using type = T; + }; + + /*! + * \private Trick to force a non-deduced context during template argument type deduction. + */ + template + using NonDeduced = typename Identity::type; + /*! * \private QObject subclass used by CCached class template for signal/slot communication with CValueCache. * An instance of this class is shared between all CCached referring to the same CValueCache and owned by the same QObject,