mirror of
https://github.com/ETLCPP/etl.git
synced 2026-11-09 14:49:53 +08:00
Added C++11 variadic template version of etl::observer
This commit is contained in:
parent
55dda4ea9d
commit
7c77bc80b2
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user