From 2862b3b247abb2727ea6724bd456879e2bfdb111 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 21 Jan 2026 09:50:15 +0100 Subject: [PATCH] Added etl::type_list to etl::nth_type --- include/etl/nth_type.h | 8 ++++++++ test/test_nth_type.cpp | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/etl/nth_type.h b/include/etl/nth_type.h index 01f2a6e8..20c4d2d9 100644 --- a/include/etl/nth_type.h +++ b/include/etl/nth_type.h @@ -31,6 +31,7 @@ SOFTWARE. #include "platform.h" #include "static_assert.h" +#include "type_list.h" #if ETL_USING_CPP11 namespace etl @@ -60,6 +61,13 @@ namespace etl using type = typename private_nth_type::nth_type_helper::type; }; + //*********************************** + template + struct nth_type> : public nth_type + { + using nth_type::type; + }; + //*********************************** template using nth_type_t = typename nth_type::type; diff --git a/test/test_nth_type.cpp b/test/test_nth_type.cpp index a5339292..843d7607 100644 --- a/test/test_nth_type.cpp +++ b/test/test_nth_type.cpp @@ -29,6 +29,7 @@ SOFTWARE. #include "unit_test_framework.h" #include "etl/nth_type.h" +#include "etl/type_list.h" #include namespace @@ -42,5 +43,15 @@ namespace CHECK((std::is_same, long>::value)); CHECK((std::is_same, double>::value)); } + + //************************************************************************* + TEST(test_nth_type_from_type_list) + { + using types = etl::type_list; + + CHECK((std::is_same, int>::value)); + CHECK((std::is_same, long>::value)); + CHECK((std::is_same, double>::value)); + } } }