Added type_list definitions for nth_type and observer

This commit is contained in:
John Wellbelove 2026-01-25 11:09:59 +01:00
parent 01a0b63919
commit 682b1e7011
2 changed files with 11 additions and 3 deletions

View File

@ -58,14 +58,16 @@ namespace etl
{
ETL_STATIC_ASSERT(Index < sizeof...(TTypes), "etl::nth_type index 'Index' out of bounds");
using type = typename private_nth_type::nth_type_helper<Index, TTypes...>::type;
using type = typename private_nth_type::nth_type_helper<Index, TTypes...>::type;
using type_list = etl::type_list<TTypes...>;
};
//***********************************
template <size_t Index, typename... TTypes>
struct nth_type<Index, etl::type_list<TTypes...>> : public nth_type<Index, TTypes...>
struct nth_type<Index, etl::type_list<TTypes...>>
{
using typename nth_type<Index, TTypes...>::type;
using type = typename nth_type<Index, TTypes...>::type;
using type_list = typename nth_type<Index, TTypes...>::type_list;
};
//***********************************

View File

@ -309,6 +309,7 @@ namespace etl
using observer<T1>::notification;
using observer<TRest...>::notification;
using type_list = etl::type_list<T1, TRest...>;
};
//*****************************************************************
@ -323,6 +324,8 @@ namespace etl
virtual ~observer() = default;
virtual void notification(T1) = 0;
using type_list = etl::type_list<T1>;
};
//*****************************************************************
@ -337,6 +340,8 @@ namespace etl
virtual ~observer() = default;
virtual void notification() = 0;
using type_list = etl::type_list<>;
};
//*****************************************************************
@ -350,6 +355,7 @@ namespace etl
public:
using observer<TTypes...>::notification;
using type_list = etl::type_list<TTypes...>;
};
#else