From 7f9abdab3a7e07c25b0e029a0f68e9ff2cd25ad8 Mon Sep 17 00:00:00 2001 From: profezzorn Date: Thu, 14 Dec 2023 23:26:27 -0600 Subject: [PATCH] fix tests --- common/typelist.h | 42 ++++++++++++++++++++++++------------------ styles/mix.h | 2 +- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/common/typelist.h b/common/typelist.h index 95738e500..e7da351e7 100644 --- a/common/typelist.h +++ b/common/typelist.h @@ -1,6 +1,8 @@ #ifndef COMMON_TYPELIST_H #define COMMON_TYPELIST_H +#include + template struct TypeList { static const size_t size = sizeof...(T); @@ -25,39 +27,43 @@ template // Use this one template using ConcatTypeLists = typename::ConcatTypeListsHelper::type; +// First +template struct FirstTypeListHelper { }; +template +struct FirstTypeListHelper> { typedef FIRST type; }; +template using FirstTypeList = typename FirstTypeListHelper::type; + +// Rest +template struct RestTypeListHelper { }; +template +struct RestTypeListHelper> { typedef TypeList type; }; +template using RestTypeList = typename RestTypeListHelper::type; + + // Head -template struct HeadTypeListHelper { }; -template -struct HeadTypeListHelper<0, TypeList> { - typedef TypeList type; +template struct HeadTypeListHelper { + typedef typename HeadTypeListHelper>::type type; }; -template - struct HeadTypeListHelper> { - typedef typename HeadTypeListHelper>::type type; +template +struct HeadTypeListHelper<0, TL> { + typedef TL type; }; template using HeadTypeList = typename::HeadTypeListHelper::type; // Tail -template struct TailTypeListHelper { }; +template +struct TailTypeListHelper { + typedef typename::TailTypeListHelper, ConcatTypeLists>>>::type type; +}; template struct TailTypeListHelper<0, TL, prefix> { typedef prefix type; }; -template - struct TailTypeListHelper, TypeList> { - typedef typename TailTypeListHelper, TypeList >::type type; -}; template using TailTypeList = typename::TailTypeListHelper>::type; -// First -template struct FirstTypeListHelper { }; -template -struct FirstTypeListHelper> { typedef FIRST type; }; -template using FirstTypeList = typename FirstTypeListHelper::type; - template struct SplitTypeList { diff --git a/styles/mix.h b/styles/mix.h index 77d028be0..ec02aeeba 100644 --- a/styles/mix.h +++ b/styles/mix.h @@ -72,8 +72,8 @@ class MixHelper2> { private: PONUA MixHelper2>::first_half> a_; PONUA MixHelper2>::second_half> b_; - static int size() { return 1 + sizeof...(B); } public: + static int size() { return 1 + sizeof...(B); } auto getColor(int x, int led) -> decltype(MixColors(a_.getColor(0, led), b_.getColor(0, led), 1, 1)) { if (x < a_.size()) return a_.getColor(x, led); return b_.getColor(x - a_.size(), led);