#pragma once #include #include #include namespace DB { template struct TypeList { static constexpr size_t size = 0; template using At = std::nullptr_t; template static void forEach(Func && /*func*/) { } }; template struct TypeList { using Head = THead; using Tail = TypeList; static constexpr size_t size = 1 + sizeof...(TTail); template using At = typename std::template conditional_t>; template static void ALWAYS_INLINE forEach(Func && func) { func.template operator()(); Tail::template forEach(std::forward(func)); } }; /// Prepend Type to TypeList /// Usage: /// using TypeListWithType = typename AppendToTypeList::Type; template struct PrependToTypeList { using Type = typename PrependToTypeList::Type; }; template struct PrependToTypeList, Types ...> { using Type = TypeList; }; /// Append Type to TypeList /// Usage: /// using TypeListWithType = typename AppendToTypeList::Type; template struct AppendToTypeList { using Type = typename AppendToTypeList::Type; }; template struct AppendToTypeList, Types ...> { using Type = TypeList; }; /// Apply TypeList as variadic template argument of Class. /// Usage: /// using ClassWithAppliedTypeList = typename ApplyTypeListForClass::Type; template