From 7c77bc80b2079a18cd340c666dae2d6f760e97d2 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sat, 30 Mar 2019 10:40:19 +0000 Subject: [PATCH] Added C++11 variadic template version of etl::observer --- include/etl/observer.h | 35 +++++++++++++++++++++++++++++++++-- include/etl/version.h | 2 +- support/Release notes.txt | 4 ++++ 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/include/etl/observer.h b/include/etl/observer.h index 06d07dfc..dcc1edb3 100644 --- a/include/etl/observer.h +++ b/include/etl/observer.h @@ -186,17 +186,46 @@ namespace etl } protected: - + ~observable() { } - + private: /// The list of observers. Observer_List observer_list; }; +#if ETL_CPP11_SUPPORTED && !defined(ETL_OBSERVER_FORCE_CPP03) + + //***************************************************************** + /// The observer class for N types. + ///\ingroup observer + //***************************************************************** + template + class observer : public observer, public observer + { + public: + + using observer::notification; + using observer::notification; + }; + + //***************************************************************** + /// The specialised observer class for 1 type. + ///\ingroup observer + //***************************************************************** + template + class observer + { + public: + + virtual void notification(T1) = 0; + }; + +#else + //********************************************************************* /// The observer interface for eight notification types. ///\ingroup observer @@ -355,6 +384,8 @@ namespace etl virtual ~observer() {} virtual void notification(T1) = 0; }; + +#endif } #undef ETL_FILE diff --git a/include/etl/version.h b/include/etl/version.h index 765ded77..85d56f97 100644 --- a/include/etl/version.h +++ b/include/etl/version.h @@ -38,7 +38,7 @@ SOFTWARE. ///\ingroup utilities #define ETL_VERSION_MAJOR 14 -#define ETL_VERSION_MINOR 16 +#define ETL_VERSION_MINOR 17 #define ETL_VERSION_PATCH 0 #define ETL_VERSION ETL_STRINGIFY(ETL_VERSION_MAJOR) ETL_STRINGIFY(ETL_VERSION_MINOR) ETL_STRINGIFY(ETL_VERSION_PATCH) diff --git a/support/Release notes.txt b/support/Release notes.txt index 594e30a8..1ef4d2dc 100644 --- a/support/Release notes.txt +++ b/support/Release notes.txt @@ -1,3 +1,7 @@ +=============================================================================== +14.17.0 +Added C++11 variadic templates for etl::observer. + =============================================================================== 14.16.0 Added C++11 variadic templates for etl::visitable and etl::visitor.