Added C++11 variadic template version of etl::observer

This commit is contained in:
John Wellbelove 2019-03-30 10:40:19 +00:00
parent 55dda4ea9d
commit 7c77bc80b2
3 changed files with 38 additions and 3 deletions

View File

@ -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 <typename T1, typename... Types>
class observer : public observer<T1>, public observer<Types...>
{
public:
using observer<T1>::notification;
using observer<Types...>::notification;
};
//*****************************************************************
/// The specialised observer class for 1 type.
///\ingroup observer
//*****************************************************************
template <typename T1>
class observer<T1>
{
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

View File

@ -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)

View File

@ -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.